On Jul 31, 2010, at 08:32 AM, Steven D'Aprano wrote: >On Sat, 31 Jul 2010 07:44:42 am Guido van Rossum wrote: >> On Fri, Jul 30, 2010 at 1:53 PM, Barry Warsaw <ba...@python.org> >wrote: >> > On Jul 30, 2010, at 01:42 PM, Guido van Rossum wrote: >> >>Well it is a reserved name so those packages that were setting it >> >>should have known that they were using undefined behavior that >> >> could change at any time. >> > >> > Shouldn't it be described here then? >> > >> > http://docs.python.org/reference/lexical_analysis.html#identifiers >> >> No, since it is covered here: >> >> http://docs.python.org/reference/lexical_analysis.html#reserved-class >>es-of-identifiers > > >I have a small concern about the wording of that, specifically this: > >"System-defined names. These names are defined by the interpreter and >its implementation (including the standard library); applications >SHOULD NOT EXPECT TO DEFINE additional names using this convention. >The set of names of this class defined by Python may be extended in >future versions." [emphasis added] > >This implies to me that at some time in the future, Python may make it >illegal to assign to any __*__ name apart from those in a list >of "approved" methods. Is that the intention? I have always understood >that if you create your own __*__ names, you risk clashing with a >special method, but otherwise it is allowed, if disapproved off. I >would not like to see it become forbidden.
I'm with Steven on this one. I've always understood the rules on double-underscore names to mean that Python reserves the use of those names for its own purposes, and is free to break your code if you define your own. That's very different than saying it's forbidden to use double-underscore names for your own purposes or assign to them, which is I think what's going on with the sys.__debug__ example. If that's the rule, I'd want to make this section of the documentation much stronger about the prohibitions. I've just never considered Python's rule here to be that strong. -Barry
signature.asc
Description: PGP signature
_______________________________________________ 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