~/talk

Comprehensible Comprehensions

Talkat PyCon US 2020 · 2020-04-15..04-23· [python]
slides:none on file

Explains when comprehensions are the right tool and when plain loops or builtins like dict() or list() are clearer, shows concrete translations by copy/paste from for loop to comprehension, and demonstrates list, set, dictionary comprehensions plus generator expressions. Emphasizes generators are lazy and single-use so prefer them when you iterate once, warns against side effects inside comprehensions, and recommends breaking long comprehensions over multiple lines for readability while giving slide examples and code snippets.

AI-written summary · about

  1. 0:00Start
  2. 0:26Comprehensible Comprehensions
  3. 2:09for loops
  4. 7:58Copy-pasting into a comprehension
  5. 18:49Generator Comprehensions
  6. 20:15Generator Expression Syntax
  7. 22:23Loop over them right away
  8. 23:22Generator Expressions
  9. 26:27Don't abuse comprehensions
  10. 30:29Not filtering or changing anything?
~/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.