Skip to content Skip to sidebar Skip to footer

C Code For Python's Property Function?

I am really curious as to how Python's interpreter makes an attribute x out of a method x through x=property(x). If I could take a look at the C code, I would feel much better.

Solution 1:

The type is defined in the descrobject.c file.

You can locate Python types like these by first looking for the function name in bltinmodule.c; in this case the following line defines the property() function:

SETBUILTIN("property",              &PyProperty_Type);

then grep for the PyProperty_Type definition in the Objects subdirectory.

Post a Comment for "C Code For Python's Property Function?"