Why property works only for objects?

John J. Lee jjl at pobox.com
Mon Mar 13 15:02:38 EST 2006


Michal Kwiatkowski <ruby at no.spam> writes:
[...]
> "Return a property attribute for new-style classes". After reading a bit
> about descriptors I've just assumed that property is a handy way to
> create (any) descriptors. Learning that it only creates overriding
> descriptors was a bit shocking. I'm not suggesting it's bad behavior,
> only that it seemed unexpected for an unaware programmer. What at first
> glance looked like a shortcut, turned out to be designed for a specific
> use case.
[...]

Python builtins (especially the newer ones, perhaps) are often
targetted fairly tightly on particular use cases.


John




More information about the Python-list mailing list