New submission from Andre Roberge <andre.robe...@gmail.com>:

Consider the following:

Python 3.10.0rc1  ...
>>> __debug__
True
>>> del __debug__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name '__debug__' is not defined
>>> __debug__
True
>>> __debug__ = False
  File "<stdin>", line 1
SyntaxError: cannot assign to __debug__

I suggest that attempting to delete __debug__ should be a SyntaxError, similar 
to attempting to delete None and other constants.

>>> del None
  File "<stdin>", line 1
    del None
        ^^^^
SyntaxError: cannot delete None

= = =
The same NameError exception is raised for Python 3.9 when attempting to delete 
__debug__.  For Python 3.8, attempting to delete __debug__ silently fails, so 
the current behaviour is at least an improvement.

----------
components: Parser
messages: 400256
nosy: aroberge, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: del __debug__ should be a SyntaxError
type: behavior
versions: Python 3.10

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45000>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to