Monthly Archives: October 2008

Functions are descriptors

I didn’t knew that till i’ve read Ian’s post on decora-descriptors (I guess I can call them that). Actually it’s explained in more details here.
On short, functions have the __get__ method that make them work as descriptors when they are in a class.
I can do this:

>>> class Bar:
… pass

>>> bar = [...]