—Prerequisites
5m 42s
Organizing Larger Programs
- 30m 7s
—Packages
2m 28s
—Imports From sys.path
3m 35s
—Implementing Packages
3m 38s
—Subpackages
1m 26s
—Example: A Full Program
1m 49s
—Relative Imports
2m 47s
—Controlling Imports With __all__
1m 25s
—Namespace Packages
3m 20s
—Executable Directories
3m 15s
—Recommended Layout
1m 16s
—Duck Tails: Modules Are Singletons
1m 22s
—Summary
3m 40s
Beyond Basic Functions
- 32m 28s
—Function Review
2m 30s
—Callable Instances
4m 42s
—Classes Are Callable
2m 21s
—Conditional Expressions
1m 1s
—Lambdas
4m 54s
—Detecting Callable Objects
1m 5s
—Extended Formal Argument Syntax
6m 53s
—Extended Call Syntax
2m 26s
—Forwarding Arguments
0m 54s
—Duck Tail: Transposing Tables
2m 31s
—Summary
3m 5s
Closures and Decorators
- 36m 57s
—Local Functions
5m 4s
—Returning Functions From Functions
1m 5s
—Closures and Nested Scopes
1m 51s
—Function Factories
1m 30s
—The Nonlocal Keyword
5m 50s
—Function Decorators
2m 6s
—A First Decorator Example
2m 54s
—What Can Be a Decorator?
2m 15s
—Instances as Decorators
2m 8s
—Multiple Decorators
2m 0s
—Decorating Methods
0m 49s
—functools.wraps()
4m 24s
—Duck Tails: Validating Arguments
2m 17s
—Summary
2m 38s
Properties and Class Methods
- 40m 47s
—Class Attributes
6m 2s
—Static Methods
1m 49s
—Class Methods
5m 27s
—Static Methods With Inheritance
3m 39s
—Class Methods With Inheritance
4m 1s
—Properties
7m 26s
—Properties and Inheritance
7m 26s
—Duck Tail: The Template Method Pattern
3m 3s
—Summary
1m 48s
Strings and Representations
- 18m 45s
—Two String Representations
1m 30s
—repr()
2m 52s
—str()
0m 59s
—When Are the Representations Used?
1m 51s
—Interaction With format()
2m 26s
—reprlib
2m 30s
—asciii(), ord(), and chr()
1m 43s
—Duck Tail: Bigger Isn't Always Better
2m 10s
—Summary
2m 41s
Numeric and Scalar Types
- 1h 2m
—Reviewing int and float
5m 42s
—The Decimal Module and the Decimal Type
10m 31s
—Rational Numbers With the Fraction Type
3m 6s
—The Complex Type and the cmath Module
5m 46s
—Built-In Numeric Functions abs() and round()
2m 54s
—Number Base Conversions
1m 43s
—The datetime Module and date Type
5m 21s
—The time Type
2m 0s
—The datetime Type
3m 35s
—Durations With the timedelta Type
1m 14s
—Arithmetic With datetime
0m 54s
—Time Zones
2m 54s
—Duck Tail: Floating Point Versus Rational Numbers
12m 46s
—Summary
3m 41s
Iterables and Iteration
- 29m 45s
—Multi-Input Comprehensions
4m 18s
—Nested Comprehensions
1m 39s
—The map() Function
3m 27s
—Multiple Input Sequences
1m 46s
—map() Versus Comprehensions
0m 41s
—The filter() Function
1m 58s
—The functools.reduce() Function
2m 43s
—Combining map() and reduce()
1m 37s
—The Iteration Protocols
2m 24s
—Putting the Protocols Together
0m 58s
—Alternative Iterable Protocol
0m 58s
—Extended iter() Format
1m 47s
—Duck Tail: Iterator for Streamed Sensor Data
1m 46s
—Summary
3m 36s
Inheritance and Subtype Polymorphism
- 36m 50s
—Inheritance Overview
3m 50s
—A Realistic Example: SortedList
1m 44s
—The Built-In isinstance() Function
2m 34s
—The Built-In issubclass() Function
1m 7s
—Multiple Inheritance
2m 44s
—Details of Multiple Inheritance
1m 17s
—Method Resolution Order
3m 45s
—How is Method Resolution Order Calculated?
1m 44s
—The Built-In super() Function
1m 57s
—Class-Bound Super Proxies
2m 32s
—Instance-Bound Super Proxies
1m 50s
—Calling super() Without Arguments
1m 16s
—SortedIntList Explained
1m 39s
—The Object Class
2m 10s
—Duck Tail: Inheritance for Implementation Sharing
1m 28s
—Summary
5m 6s
Implementing Collections
- 52m 48s
—Collection Protocol Overview
1m 19s
—Collection Construction
5m 18s
—The Container Protocol
2m 18s
—The Sized Protocol
2m 26s
—The Iterable Protocol
2m 40s
—The Sequence Protocol: Indexing
2m 36s
—The Sequence Protocol: Slicing
3m 21s
—Comprehensible Test Results With __repr__()
1m 37s
—Implementing Equality and Inequality
4m 30s
—The Sequence Protocol: Reversing
1m 10s
—The Sequence Protocol: index()
2m 2s
—The Sequence Protocol: count()
0m 43s
—Improving Performance From O(N) to O(log n)
4m 22s
—Refactoring to Avoid Don't Repeat Yourself (DRY)
2m 0s
—Checking Protocol Implementations
3m 3s
—The Sequence Protocol: Concatenation and Repetition
3m 55s
—The Set Protocol
5m 30s
—Duck Tail: Making a Mutable Set
1m 4s
—Summary
2m 48s
Exceptions and Errors
- 37m 48s
—Always Specify an Exception Type
4m 1s
—The Standard Exception Hierarchy
4m 34s
—Exception Payloads
3m 56s
—Defining New Exceptions
3m 20s
—Chaining Exceptions
4m 27s
—Traceback Objects
2m 37s
—Assertions: Internal Invariants
3m 43s
—Assertions: Class Invariants
1m 21s
—Assertions: Performance
1m 38s
—Duck Tail: Preconditions and Postconditions
6m 4s
—Summary
2m 4s
Defining Context Managers
- 29m 15s
—What is a Context Manager?
2m 45s
—The Context Manager Protocol
2m 10s
—A First Context Manager Example
2m 47s
—__enter__()
1m 11s
—__exit__()
1m 43s
—__exit__() and Exception Propagation
2m 16s
—The with-statement Expansion
0m 58s
—contextlib.contextmanager
4m 41s
—Multiple Context Managers
2m 46s
—Don't Pass a List!
1m 16s
—Duck Tail: Context Managers for Transactions
2m 56s
—Summary
3m 41s
—Object Types in Depth
3m 5s
—Introspecting Objects
5m 7s
—Introspecting Scopes
2m 59s
—The Python Standard Library Inspect Module
4m 25s
—Duck Tail: An Object Introspection Tool
11m 35s
—Summary
1m 55s