~/talk

Decorators demystified

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

Explains what happens when you use Python's @ decorator syntax by diving into scopes, namespaces and closures to show how decorators work internally. Uses these language features to walk through building a custom decorator by hand, aimed at developers with intermediate Python knowledge.

AI-written summary · about

  1. 0:00Start
  2. 1:41A simple software cache
  3. 2:33Use functools.lru_cache, not this!!!
  4. 3:09Factorial and fibonacci functions
  5. 3:49How are we accessing this attribute?
  6. 4:38How are recursive calls possible?
  7. 4:55A simpler case
  8. 6:21Python namespaces examples
  9. 8:58Python namespaces lifetimes
  10. 12:17Python nested scopes
  11. 15:21Python scopes
  12. 16:39Another more complex case
  13. 18:48There is a closure!
  14. 24:16DRY: Don't Repeat Yourself!
  15. 24:43Original function is not modified
  16. 26:18Create original fibonacci function
  17. 26:37Create alternative name pointing to the same function object
  18. 26:52Replace original name with new a function which calls the alternative name
  19. 28:13A factory of memoization functions
  20. 30:23Decorators demystified
  21. 30:56Q&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.