Become a Better Pythonista by Abusing List Comprehensions and :=
summary
Covers concrete gotchas: the walrus operator assigns inside expressions but evaluation order can raise NameError when the right side runs before the left; wrapping a call in a lambda to delay execution lets a function be defined as an argument and avoids immediate errors; demonstrates a one‑line recursive function that technically works but is unreadable; shows how generator laziness can defer side effects (even mutating globals) and how nested comprehension order is reversed, causing undefined variables.
AI-written summary · about
chapters (10)
- 0:00Introduction to Python tricks
- 1:07Walrus operator order of execution
- 4:58Recursive function in one line
- 8:50Why abuse these tricks
- 12:08Comprehensions and generators
- 13:34Generator trick in function calls
- 14:18Global variable side effects
- 17:10Nested comprehensions pitfalls
- 18:37Final example walkthrough
- 19:43Performance and readability








