[Python-Dev] Is it intentional that "sys.__debug__ = 1" isillegal in Python 2.7?

Barry Warsaw barry at python.org
Sat Jul 31 18:41:22 CEST 2010


On Jul 30, 2010, at 05:23 PM, Eric Snow wrote:

>First appeared in docs for 2.6 (October 02, 2008).  Not sure if that
>is when it first because constrained this way.
>
>http://docs.python.org/library/constants.html?highlight=__debug__#__debug__

Thanks Eric, this is probably the right section of the docs to reference on
the issue.  I want to add two clarifications to this section:

* Be more explicit that assigments to None and __debug__ are illegal even when
  used as attributes.  IOW it's not just assignment to the built-in names that
  are illegal.

* Add a "Changed in 2.7" to __debug__ stating that assignments to __debug__ as
  an attribute became illegal.

From this though, I think it's clear that Benjamin's change was intentional.
I will also add this to the NEWS and What's New files for 2.7.

-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-dev/attachments/20100731/f59f49e3/attachment.pgp>


More information about the Python-Dev mailing list