Fantastic Blocks And Where To Hide Them
summary
Claims that Python lacks anonymous blocks are backed by history: a 2005 PEP to pass thunks is rejected, the with statement is chosen instead, and async/await arrives years later after JavaScript borrows co-routine syntax. The talk builds working implicit builders and a fold/either implementation using decorators, demonstrates they function but confuse control flow by hijacking def and decorator semantics, and argues for restricting decorators to their conventional role and adding explicit syntax for these patterns.
AI-written summary · about
chapters (31)
- 0:00Intro
- 1:26Thank you for coming!
- 2:20Python Ruby
- 3:57Interfaces that expect blocks are not Pythonic
- 4:29Is Python keeping up with
- 4:44Context Managers Blocks vs Structured Delegation
- 5:13Ruby on Rails
- 8:18Ruby's model depends on convention.
- 8:37Python opted for syntax that communicates structure
- 9:00Asynchronous I/O Non-Blocking Blocks
- 10:462008
- 11:57Blocks look terrible
- 13:10Not having blocks meant Python explored coroutines
- 13:50Python found better patterns because it didn't have blocks.
- 14:00The Builder Pattern Implicit is better than Explicit?
- 15:05Complex Data Structures
- 15:45Builders are Intermediaries
- 16:56Can this work in Python?
- 17:45But What's The Syntax?
- 18:49Is this good Python?
- 19:31Are decorators Pythonic?
- 20:01Error Handling Exceptions: Exceptional?
- 20:28Python only provides one tool for handling errors.
- 22:33The Either Type
- 22:47The Union Type
- 23:25Fold is convention. What about Syntax?
- 23:37Pattern Matching
- 24:14Surely matching on types isn't Pythonic?
- 25:26What about fold?
- 27:13Decorators let you call functions by defining functions.
- 28:26North Bay Python 2019 Petaluma, California CFP closes Friday!
related talks
28mHere be dragons: some elegant and ugly hacks in CPython
38mBecause You Can Run, You Can't Hide: Some Musings on API Design
46mOn Being Pythonic
31mGuardrails: An Alternative View of Safely Working in Python
27mFunctional Programming for Pythonistas
01h 10mKeynote 2: Robust Python and Why It Matters
31mGuardrails: An Alternative View of Safely Working in Python
31mDon't Do This
