~/talk

HOWTO Write a Function

Talkat PyCon 2018 · on Saturday, 2018-05-12· [developer-experience]
slides:none on file

Argues that a good function is small and predictable: gather inputs-transform-output at the top middle and bottom, validate early with asserts and early return, expose a dry run flag for non‑destructive checks, use readable names like raw/ignored/_ and pair/left/right for arity, return consistent types (empty list not None) or raise, prefer simple loops over clever one‑liners, avoid overzealous linter rules and gratuitous new language features, and put constants in defaults when that clarifies intent.

AI-written summary · about

  1. 0:00Intro
  2. 1:03Why talk about Code Reviews?
  3. 2:00Why talk about a function?
  4. 4:14HOWTO write a function
  5. 5:05Thinking about function structure
  6. 7:39Transform
  7. 8:50All About The Inputs
  8. 11:34Asserts Add Information
  9. 12:36Return Early adds confidence
  10. 13:40The gun on the mantle
  11. 17:24Names have meaning
  12. 23:44Return consistently
  13. 26:42Keep It Together
  14. 28:09Language Features are an attractive nuisance
  15. 31:58All effort feels like useful effort
  16. 33:19Linters are an attractive nuisance
  17. 35:33Code Reviewer's Smells
  18. 37:09Summary
  19. 37:25Thank You PyCon
~/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.