~/talk

The Art of Subclassing

Talkat EuroPython 2011 · 2011-06-20..06-26· [python]
slides:none on file

Reframes subclassing as operational code reuse: subclasses delegate to parent function dictionaries and thus are “in charge,” not mere specializations. Demonstrates practical tools and patterns: use super so the delegate pointer can change (example: a one‑line Counter→OrderedDict swap that works), isolate constructor differences via from_iterable for ABC mixins, and protect internal invariants with double-underscore mangling (e.g., __update) so built‑ins don’t break subclass behavior. Shows concrete examples (Animal/Dog, Circle/Donut, SimpleHTTPServer, cmd module, mutable set) and which techniques succeed.

AI-written summary · about

  1. 0:00Start
  2. 9:29Internal Call Patterns
  3. 14:51Chain of Dictionaries
  4. 23:39Substitution Principle
  5. 24:02Substitutability
  6. 25:52The Constructor Signature
  7. 51:19Principles for Writing Subclasses
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.