[Python-Dev] Issue10403 - using 'attributes' instead of members in documentation (original) (raw)

Brett Cannon brett at python.org
Tue Jun 28 21:05:39 CEST 2011


On Tue, Jun 28, 2011 at 06:28, Nick Coghlan <ncoghlan at gmail.com> wrote:

On Tue, Jun 28, 2011 at 10:56 PM, Michael Foord <fuzzyman at voidspace.org.uk> wrote: > 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).

"callable attributes" and "data attributes" are purely about the API exposed by the object in question. If we're going for object model neutral terminology, that's the only view that makes sense. They're descriptions about how attributes are intended to be used that are completely silent on the question of how they're implemented. So staticmethod would fall into the first group, while property would fall into the latter.

These two terms also have the benefit of being understandable by non Python programmers. Since we can't rely on people read the glossary or any other specific doc before reading the stdlib docs we need to make sure that the terminology that we use can be understood by newbies. Thus I like data and callable attributes since it makes sense even if you come from another programming language since you can easily reason it out.

And now I am done adding my graffiti to the shed.

-Brett

>From an implementation point of view, you carve up the world differently, so it makes sense to worry about class attributes, instance attributes, dynamic attributes, etc. (the class vs instance distinction can also matter to some degree from the usage point of view, since it affects the scope of any mutable attributes, and the static vs dynamic distinction can also matter, especially for introspection purposes). This goes back to the original point about all of this being highly context dependent - how you carve up the set of all attributes is going to change based on what you're trying to explain (e.g. the distinction between enforced 'data' descriptors, descriptors that allow shadowing in the instance dict, class attributes that aren't descriptors at all, instance attributes and dynamic attributes retrieved via getattr is another way of dividing them) Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia


Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/brett%40python.org -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20110628/1a3fb3f7/attachment.html>



More information about the Python-Dev mailing list