On Mon, May 16, 2005 at 08:09:54PM -0500, Ka-Ping Yee wrote:
> On Mon, 16 May 2005, Aahz wrote:
> > I'll comment here in hopes of staving off responses from multiple
> > people: I don't think these should be double-underscore attributes.  The
> > currently undocumented ``args`` attribute isn't double-underscore, and I
> > think that's precedent to be followed.
> 
> That isn't the criterion i'm using, though.  Here's my criterion, and
> maybe then we can talk about what the right criterion should be:
> 
>     System attributes are for protocols defined by the language.
> 
> (I'm using the term "system attribute" here to mean "an attribute with
> a double-underscore name", which i picked up from something Guido
> wrote a while back [1].)
> 
> For example, __init__, __add__, __file__, __name__, etc. are all
> attributes whose meaning is defined by the language itself as opposed
> to the Python library.  A good indicator of this is the fact that
> their names are hardcoded into the Python VM.  I reasoned that
> __cause__, __context__, and __traceback__ should also be system
> attributes since their meaning is defined by Python.
> 
> Exceptions are just classes; they're intended to be extended in
> arbitrary application-specific ways.  It seemed a good idea to leave
> that namespace open.

I prefer trichomomies over dichotomies, but whether single or double 
underscores are "the bad" or "the ugly" I'll leave to others.  In python
double underscores can only mean "I don't handle this, my class does" or
"I'm a C++ weenie, can I pretend this is private?"

Excluding the "private" non-argument the only question is where it goes 
in the class hierarchy.  Is it a property you would normally associate
with the instance, the class of an instance, or the class of a class (type).

To me it feels like a property of the instance.  The values are never
shared by expections of the class so just make it a plain variable to remind
other people of that too.

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