On 28/06/2011 13:31, Nick Coghlan wrote:
On Tue, Jun 28, 2011 at 8:54 PM, Michael Foord
<fuzzy...@voidspace.org.uk>  wrote:
The problem with "data attributes" is that it doesn't mean *anything*, which
I suppose is useful for invented terminology, but it means it doesn't convey
anything precise to those who haven't heard the term before. If it becomes
widely used then that changes I guess. I'd still normally just use
"attributes" though...
In this context, precision is an illusion. There is *no* precise
terminology,
"instance members" is precise, (whether or not an attribute is fetched "from the instance" is one thing that is clear in the python data model - there are just lots of other ways of fetching attributes too). "instance members" just doesn't cover all the cases where you may want to group attributes together though.

However, providing "__getattr__" and "__getattribute__" is not the common case and even properties are *usually* backed by a real instance attribute. So "instance attributes" as opposed to other types of attributes is *often* a useful distinction.

I don't think "data attributes" is clear or precise. Is a property a data attribute (well it depends how it is implemented and what it does), is a staticmethod a data attribute (no - but then Tres' question - it isn't a normal method either so if you define data attribute to mean "all non method attributes" then its potentially an open question).

All the best,

Michael Foord

not only because Python blurs the boundaries by design in
many respects (callable or not, method or not, attribute or not, etc),
but also because *people* use the same words to mean slightly
different things.

The best we can hope for is to encourage the right way of thinking
about the situation, and in that regard you have the complete set of
attributes accessible via an object (i.e. via __getattribute__), some
of which are callables (and may or may not act like instance methods)
and the remainder of which are data attributes (some of which may
incidentally be callable, even if they aren't used that way). How a
*particular* attribute is classified is not an inherent property of
the attribute, but also an artifact of the way it is used by the
application.

Cheers,
Nick.



--
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

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to