[Python-Dev] Is it intentional that "sys.__debug__ = 1" is illegal in Python 2.7?
Steven D'Aprano
steve at pearwood.info
Sat Jul 31 00:32:59 CEST 2010
On Sat, 31 Jul 2010 07:44:42 am Guido van Rossum wrote:
> On Fri, Jul 30, 2010 at 1:53 PM, Barry Warsaw <barry at 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.
--
Steven D'Aprano
More information about the Python-Dev
mailing list