~/talk

Python - best practices

Talkat Conf42 Python 2021 · on Thursday, 2021-05-27· [python, developer-experience]
slides:none on file

Benchmarks and small scripts demonstrate concrete tradeoffs: prefer builtins for speed and clarity, fail‑fast shows ~0.005ms vs 0.013ms (≈50% faster), and deferred imports (e.g., numpy, urllib) avoid the import delay ~264ms cost when rarely needed. Memoize expensive pure functions — an LRU cache collapses recursive Fibonacci time to near‑zero. For loops vs listcomp vs map: list comprehensions win raw time, map wins readability at scale. Use ''.join over + for concatenation and generators to cut memory. Repository with code is provided.

AI-written summary · about

  1. 0:00Python best practices intro
  2. 1:40Built-in methods for efficiency
  3. 3:27Fail fast for performance
  4. 5:34Import libraries only when needed
  5. 7:21Caching method outputs
  6. 9:28Loops vs list comprehensions vs map
  7. 11:33String join vs plus
  8. 12:56Dictionary get method
  9. 15:41Generators vs lists for memory
  10. 17:03Faster condition checks with 'in'
  11. 18:28Conclusion and repo
~/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.