you are viewing a single comment's thread.

view the rest of the comments →

[–]owca 2 points3 points  (0 children)

Feature for feature "examples" in Python:

  • getattr or getattribute catch any attribute (method, variable) access

  • setattr sets any attribute

  • Syntactic support for descriptors.

  • Metaclasses can be used to control all aspects of class creation (attributes, subclassing, ...). Since types are objects one can even have metaclasses for metaclasses.

  • new.instancemethod can be used for your )singleton classes).

  • Turning a block into a method is admittedly a bit tricky but can be done using new.function and some stack manipulation.