~/talk

HOWTO write a function

Talkat PyCon Canada 2017 · 2017-11-18..11-21· [developer-experience]
links:none on file
slides:none on file

Argues that a good Python function has three concrete phases: input transform output — validate and winnow inputs up front (Django ORM example), do the work in the middle, then format or return the result; prefers return early to avoid buried side effects; recommends naming and putting defaults next to use (avoid module-level constants), consistent return types, and using language features sparingly — replaced a reduce/groupby with collections.Counter in one-hour refactor to make the code clearer.

AI-written summary · about

  1. 0:00Introduction to functions
  2. 1:21The three-phase structure
  3. 4:44Refining inputs
  4. 8:21Returning early
  5. 10:05Managing constants
  6. 12:07Exception handling
  7. 13:21Naming conventions
  8. 17:12Consistent return types
  9. 19:34Keeping related logic grouped
  10. 21:19Linter and language hazards
  11. 23:21Code review strategies
  12. 27:33Conclusion
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 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
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
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.