~/talk

Metaprogramming in Python

TalkinSpanishat EuroPython 2015 · 2015-07-20..07-26· [python]
slides:none on file

Shows practical Python 3.4 metaprogramming tools: decorators, metaclasses and a bit on descriptors. Demonstrates using functools.wraps and inspect.signature to implement annotation-based runtime type checks, a parametrizable decorator built with functools.partial and nonlocal to toggle behavior, and a metaclass that overrides __prepare__ to return an OrderedDict to enforce attribute-before-method order; includes live examples, notes on complexity, and a small metaclass-based perf-testing framework.

AI-written summary · about

  1. 0:00Introduction
  2. 1:09What is metaprogramming
  3. 3:14Functions as objects
  4. 3:57Basic decorators
  5. 5:48Metadata maintenance
  6. 8:19Decorator chaining
  7. 9:22Generic function types
  8. 11:28Python 3 type hints
  9. 14:22Type validation decorator
  10. 17:12Optional args decorators
  11. 19:22Avoiding parentheses
  12. 21:11Runtime decorator changes
  13. 23:42Metaprogramming warning
  14. 24:25Metaclasses intro
  15. 26:13Metaclasses and type
  16. 27:44Custom metaclass
  17. 29:09Attribute order control
  18. 31:35Q&A
~/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.