On 28/06/2011 12:51, R. David Murray wrote:
On Tue, 28 Jun 2011 11:54:39 +0100, Michael Foord<fuzzyman@voidspace.org.uk> wrote:
On 28/06/2011 11:44, Fred Drake wrote:
But "callable attributes" aren't the same thing as methods; most are methods, but not all. Sometimes, they're data used by the object. The fact that data attributes can be callable is irrelevant. Added to which there are other descriptors, notably property, that are not directly callable but are not provided as normal "data attributes" (although the access syntax is the same). Properties are much closer to methods as they are implemented on the class and fetched via the descriptor protocol. Instead of "data attributes" I prefer the term "instance attributes" although that doesn't include "class attributes" (or more precisely it doesn't cover "class attributes that aren't descriptors"). Also, instances can have methods as instance attributes.
Trying to use 'instance attributes' for non-method attributes is a bad idea, I think.
I would use instance attributes for members that are held in the instance dict (or have specific slots). As this can't be a normal "method" (it could be any object including a callable one - but won't be a standard method descriptor) it seems uncontroversial. (Or more to the point it seems to be *precise* in its meaning in the context of the Python data model.) What do you mean by "instances can have methods as instance attributes"? Once you attach a bound method directly to an instance it becomes a slightly different beast I think. (On top of which that is pretty rare behaviour.)
Given that there is no one thing that covers all non-method attributes, I suspect 'non-method attributes' is as good as we're going to manage.
Hehe, yeah - that's not bad... It's hard to see how it could be misunderstood too. Michael
-- R. David Murray http://www.bitdance.com
-- http://www.voidspace.org.uk/ May you do good and not evil May you find forgiveness for yourself and forgive others May you share freely, never taking more than you give. -- the sqlite blessing http://www.sqlite.org/different.html