Courses/Advanced Deep Dives

๐Ÿ”ฌ Advanced Deep Dives

Typed Attributes with Descriptors

Enforce a type on every assignment.

Descriptors run code when an attribute is read or written. __set_name__ learns the attribute name at class-creation time so the descriptor can store its value on the instance.

main.py
Output
Press Run to execute.
Expected output
caught: want int
Ada 36

Sign in to track your progress across lessons.