New submission from Jonathan Fine <jfine2...@gmail.com>:

The identifiers True, False, None and __debug__ are keywords in the language.  
For example
>>> __debug__ = __debug__
SyntaxError: assignment to keyword


1. The page constants.html incorrectly says then are in the built-in namespace. 
Some of them were, once.

2. The list keyword.kwlist does not contain __debug__. (Problem in 
Lib/keyword.py.)

3. https://docs.python.org/3/reference/datamodel.html for None, NotImplemented, 
etc.

4. There may be other places that need looking at.

See also: 
https://github.com/jfine2358/py-jfine2358/blob/master/docs/none-is-special.md

Credit: The __debug__ problem arises from Steve D'Aprano's message

https://mail.python.org/pipermail/python-ideas/2018-August/052917.html
The std lib contains a test that this correctly raises SyntaxError:
def f(*, x=lambda __debug__:0): pass

----------
assignee: docs@python
components: Documentation
messages: 323904
nosy: docs@python, jfine2358
priority: normal
severity: normal
status: open
title: docs: keywords are special - eg constants.html
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

_______________________________________
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

Reply via email to