On 9/25/2012 11:03 AM, Chris Angelico wrote:
On Wed, Sep 26, 2012 at 12:54 AM, Peter Otten <__pete...@web.de> wrote:
To me
"Data attributes override method attributes with the same name"
implies that data attributes take precedence over method attributes, not
that they replace them only when there is an assignment of data after the
method definition.
I would even consider replacing the whole paragraph
with something like
"Data attributes and method attributes share the same namespace. To avoid
name conflicts consider using verbs for methods and nouns for data
attributes"
Instance attributes override (shadow) class attributes.
except for (some? all?) special methods
Since methods
tend to be on the class and data tends to be on the instance, the
original sentence does make some sense.
but it *is* wrong
The section is talking about
conventions, so it's not inherently wrong,
The suggestion to Capitalize method names and prefix data names with '_'
are wrong with respect to the style guide.
but perhaps just needs a
comment about methods not usually being attached to the instance.
ChrisA
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list