[Python-Dev] Issue10403 - using 'attributes' instead of members in documentation
R. David Murray
rdmurray at bitdance.com
Mon Jun 27 21:22:16 CEST 2011
On Mon, 27 Jun 2011 19:27:26 +0200, Antoine Pitrou <solipsis at pitrou.net> wrote:
> Le Tue, 28 Jun 2011 00:36:20 +1000,
> Nick Coghlan <ncoghlan at gmail.com> a Ã©crit :
> > And no, the fact that methods can be treated as attributes is not a
> > minor detail. It is *fundamental* to Python's object model that
> > *methods are not a special case of attribute access*.
> Uh, and so what?
> Again, the stdlib docs are describing APIs from a high-level viewpoint, not
> the Python object model. Just because a method is treated like other
> attributes, or a function is treated like other callable objects, doesn't
> mean we should replace "method" with "attribute", or "function" with
> "callable object", or "class" with "instance of the type type".
I don't think there is any disagreement with regards to replacing
'methods' with 'attributes'. This should not be done, in general, and
I don't think anybody involved in this particular discussion thinks it
should be. The question is what to call non-method attributes, or how we
refer to a mix of method and non-method attributes. In some cases just
saying 'attributes' may make sense for the latter, but in most cases it
probably doesn't, because many people coming from other languages do
not expect methods to be first class objects. So I'd like to be able
to say, in those cases, "attributes (XXXs and methods)".
The subject of this thread is the removal of the use of the term 'members'
for XXX, for the historical reasons cited.
IMO the goal should be to help the reader's mental model match what Python
actually does. In that sense Python's object model *does* matter[*],
in that we shouldn't make it harder for the reader to figure out what is
"really" going on. In the cases you cited, you are arguing that the
more specific term (method, function, class) should not be replaced
in the docs by the more generic term (attribute, callable object,
instance of type type). I don't think anyone would argue with you
about that in general. (In specific there might in fact be some
places in the docs where such a change would improve clarity!)
So, the correct generic term for something that can be accessed
via attribute notation is attribute. The more specific term for an
attribute that is a method is method. We don't currently have a more
specific collective term for attributes that aren't methods. *That*
is the problem.
R. David Murray http://www.bitdance.com
[*] it also seems to me that the object model is, in many ways, *part*
of the API, in the sense that the API is how you access the object model,
and so understanding the object model is, if not essentially, then at
least very helpful.
More information about the Python-Dev