Re: Double underscore names

2008-02-13 Thread Steven D'Aprano
On Wed, 13 Feb 2008 09:55:39 +1100, Ben Finney wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: > >> having the ability to create a protocol is a Very Good Thing, and >> double leading and trailing underscore names are the accepted Python >> style for such special methods. > > Is it? There a

Re: Double underscore names

2008-02-12 Thread Erik Max Francis
Ben Finney wrote: > The double-underscore convention seems more for attributes *that are > interpreted specially*, e.g. by syntax operators or other core > language features. I would qualify that by adding that it's for attributes that are treated specially _and when you don't want to overload o

Re: Double underscore names

2008-02-12 Thread Steven Bethard
Steven D'Aprano wrote: > Double-underscore names and methods are special to Python. Developers are > prohibited from creating their own (although the language doesn't enforce > that prohibition). From PEP 0008, written by Guido himself: > > __double_leading_and_trailing_underscore__: "magi

Re: Double underscore names

2008-02-12 Thread Ben Finney
Steven D'Aprano <[EMAIL PROTECTED]> writes: > having the ability to create a protocol is a Very Good Thing, and > double leading and trailing underscore names are the accepted Python > style for such special methods. Is it? There are many protocols that use plain names. Even the built-in types su

Re: Double underscore names

2008-02-12 Thread Christian Heimes
Steven D'Aprano wrote: > So what do folks think? I believe the protocol idiom ("look for a method > called __parrot__ and then do something with it") is too useful and > powerful to be ignored, but then if __parrot__ is reserved by Python, > what to do? The Python core claims all rights for __m