Definition of "property"
Greg Ewing
greg.ewing at canterbury.ac.nz
Sun May 30 21:24:55 EDT 2021
On 31/05/21 9:13 am, Jon Ribbens wrote:
> No, I said it pretends to be a *data* attribute.
I don't think it's pretending to be anything. From the outside,
it's just an attribute.
Data attributes are more common than non-data attributes, so
we tend to assume that an attribute is a data attribute until
told otherwise. But that's just our psychological bias, not
because of any pretence on the part of properties.
Also, there's a sense in which *all* attributes are properties.
At the lowest level, all attribute accesses end up calling
a method. It's just that in most cases the method is implemented
in C and it looks up a value in the object's dict.
--
Greg
More information about the Python-list
mailing list