~/talk

Descriptors made easy

Talkat PyCon Italia 2024 · 2024-05-22..05-25· [python]
slides:none on file

Live coding shows Python descriptors implemented with __get__ and __set__ to replace property behavior: a Person.name descriptor computes first+last on access, assignment hooks run via __set__, and prints confirm the instance is passed in. A single class implements R/G/B by storing a position and slicing the hex string (single descriptor for R/G/B). A read‑only descriptor uses __set_name__ notified attribute name to save the assigned name and raise on set. Functions-as-descriptors (methods/properties) and all demos run successfully.

AI-written summary · about

  1. 0:00Introduction to descriptors
  2. 5:25What is a descriptor
  3. 13:41Descriptors vs properties
  4. 21:21RGB color descriptor demo
  5. 27:53Read-only descriptor design
  6. 33:57Using __set_name__
  7. 40:03Descriptors in Python methods
  8. 41:51Q&A and conclusion
~/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.