~/talk

Elegant Solutions For Everyday Python Problems

Talkat PyCon 2018 · on Friday, 2018-05-11· [python, developer-experience]
slides:none on file

Shows concrete patterns: a Money class implements dunder add and on-the-fly currency conversion so adding $ and € just works; a Server becomes iterable with a generator to yield only active services; a tiny CLI uses getattr for dynamic commands; functools.partial makes base-2 int parsing ergonomic; a roughly 400-line REST client builds paths and returns 404s when appropriate; contextmanager/decorator examples (freezegun included) restore state reliably; namedtuple defaults and subclassing finish the toolbox.

AI-written summary · about

  1. 0:00Intro
  2. 0:59slides
  3. 3:35Magic methods start and end with a double underscore (dunder)
  4. 6:16some magic methods map to symbols
  5. 6:38other magic methods map to built-in functions
  6. 7:13Making classes iterable
  7. 11:26Why does this work?
  8. 14:56Example: command line tool with dynamic commands
  9. 16:15Output
  10. 19:52define endpoint url & other connection properties
  11. 22:33Example Problem Feature Flags
  12. 24:04The better way: using the contextmanager decorator
  13. 27:47Problem: lost context using a decorator
  14. 28:05Decorators: Common uses
  15. 30:15Giving NamedTuples default values
~/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.