Fluent Python

Click on book cover image to access github

pythonic card deck
special methods
why "len" is not a method
overview
list comprehensions / generator expressions
tuples - not just immutable lists
slices
using + and * with sequences
augmented assignments
list.sort & sort built-in function
bisect
when lists aren't the answer
mapping types
dict comprehensions
mapping
dict variations
subclassing UserDict
immutable maps
sets
dict & set internals
character issues
bytes
encoders/decoders
text files
unicode
sorting unicode text
unicode database
dual-mode str & byte APIs
treating a function like an object
higher-order functions
anon functions
seven flavors of callable objects
user-defined callables
introspection
positional vs keyword-only args
param information
function annotations
packages for functional programming
case study
command
intro
python decorator execution
decorator-enhanced strategy pattern
variable scope rules
closures
nonlocal
implementation
decorators in stdlib
stacked decorators
parameterized decorators
variables are NOT boxes
identity, equality, aliases
copies are shallow by default
function params as references
del & garbage collection
weak refs
immutables tricks
object representations
vector class, redux
alternate constructors
classmethod vs staticmethod
formatted displays
hashable Vector2D
private vs protected attributes
__slots__
overriding class attributes
vectors
vector2D
protocols & duck typing
sliceable sequences
dynamic attribute access
hashing and a faster "=="
formatting
python culture
python loves sequences
monkey-patching
alex martellis waterfowl
subclassing an ABC
ABCs in stdlib
ABC definition & use
Tombola subclass testing
register
geese can behave as ducks
subclassing gotchas
multiple inheritance - method resolution
real-world multi inheritance
coping strategies
example - Django view mixins
basics
unary operators
vector addition
scalar multiplication
rich comparisons
augmented assignments
a sequence of words
iterables vs iterators
classic iterator
generator function
lazy implementation
generator expression
when to use expressions
example - arithmetic progression generator
generator functions in std library
python 3.3 new syntax
iterable reducing functions
iter
case study - db conversion utility
generators as coroutines
do this, then that
context managers & with blocks
contextlib
contextmanager
how coroutines came from generators
basic behavior
example - running average coroutine
decorators for coroutine priming
termination & exceptions
return values
yield
yield meaning
use case - discrete event simulation
examples - 3 styles of web downloads
blocking I/O and the GIL
launching processes
experiments & Executor.map
downloads & Progress Display, error handling
threads vs coroutines
downloading
blocking calls
enhancing asyncio downloader script
callbacks vs futures & coroutines
asyncio servers
data wrangling
using a property for validation
properties
property factories
attribute deletion
essential attributes & handlers
example - attribute validation
overriding vs non-overriding descriptors
methods ARE descriptors
tips
docstrings & overriding deletion
class factory
class decorator - custom descriptors
what happens when - import time vs runtime
metaclasses 101
metaclass for custom descriptors
__prepare__
classes as objects