[Python-Dev] PEP 8 and optional underscores

Georg Brandl g.brandl at gmx.net
Sun Jun 15 09:11:43 CEST 2008

Nick Coghlan schrieb:
> Benjamin Peterson wrote:
>> On Fri, Jun 13, 2008 at 12:14 PM, Guido van Rossum <guido at python.org> wrote:
>>> On Fri, Jun 13, 2008 at 9:42 AM, Benjamin Peterson
>>> <musiccomposition at gmail.com> wrote:
>>>> On Fri, Jun 13, 2008 at 11:40 AM, Raymond Hettinger <python at rcn.com> wrote:
>>>>>>   Nick>      def getName(self):
>>>>>>   Nick>          assert self.__initialized, "Thread.__init__() not called"
>>>>>>   Nick>          return self.__name
>>>>> Why is __name private to begin with?  Any reason for the getters and
>>>>> setters?  Why isn't this just an attribute?
>>>> In 3.x, it's just an attribute.
>>> Oh, is it? Where's the PEP with the API redesign? Did I miss some kind
>>> of decision-making process, weighing compatibility concerns against
>>> other issues?
>> meaning that it only has one underscore. They methods still live.
> That's worse - it means it can now collide with _name attributes on 
> subclasses.
> This has become a lot more complicated than what I thought we were 
> doing: adding PEP 8 compliant aliases for the existing methods without 
> otherwise changing the threading implementation. As far as I can recall, 
> that is all that was contained in the 2.x patch I reviewed.

The move to _attributes instead of __attributes was done quite a while
earlier, in r57222, by Guido himself.


Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.

More information about the Python-Dev mailing list