Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:
__debug__ is not a keyword. And the error message has been changed in 3.8. But it is a special enough. You can not use this name in any assignment context: >>> __debug__ = 1 File "<stdin>", line 1 SyntaxError: cannot assign to __debug__ >>> for __debug__ in []: pass ... File "<stdin>", line 1 SyntaxError: cannot assign to __debug__ >>> with cm() as __debug__: pass ... File "<stdin>", line 1 SyntaxError: cannot assign to __debug__ >>> class __debug__: pass ... File "<stdin>", line 1 SyntaxError: cannot assign to __debug__ >>> def __debug__(): pass ... File "<stdin>", line 1 SyntaxError: cannot assign to __debug__ >>> def foo(__debug__): pass ... File "<stdin>", line 1 SyntaxError: cannot assign to __debug__ >>> import __debug__ File "<stdin>", line 1 SyntaxError: cannot assign to __debug__ You can not even assign to an attribute named __debug__! >>> x.__debug__ = 1 File "<stdin>", line 1 SyntaxError: cannot assign to __debug__ The assignment operator is the only exception here, and this looks like a bug. ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34464> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com