source for the property function

Christian Heimes lists at cheimes.de
Tue Sep 2 13:36:04 EDT 2008


Rowland Smith wrote:
> Anyone know where the source code for the built-in property function is 
> located in a python distribution?
> 
> I would like to see how it works - mainly, how does it know which class 
> it is being called from?

Property is not a function but a type. Properties are a common usage for 
the descriptor protocol.

You can find the implementation of the property type in the file 
http://svn.python.org/projects/python/branches/release25-maint/Objects/descrobject.c

Christian




More information about the Python-list mailing list