This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: None missing from keyword module
Type: Stage:
Components: Documentation Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, loewis, zseil
Priority: normal Keywords: patch

Created on 2006-05-20 20:43 by zseil, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
None_keyword_trunk.diff zseil, 2006-05-20 20:43 patch against trunk revision 46059
None_keyword_24.diff zseil, 2006-05-20 20:45 patch against release24-maint revision 46058
None_constant_trunk.diff zseil, 2006-05-22 13:13 updated patch
None_constant_24.diff zseil, 2006-05-22 13:14 updated patch
Messages (5)
msg50308 - (view) Author: Ziga Seilnacht (zseil) * (Python committer) Date: 2006-05-20 20:43
None became a keyword in Python 2.4, but this is
not evident from the Python/gramminit.c file. As
a consequence, None is not included in the
keyword module when you regenerate it.

This patch also includes documentation fixes (None
was missing from keywords section in reference manual)
and fixes for syntax highliting for Idle and Vim.
python-mode.el already treats None, True and False
differently, so I didn't try to change it.
msg50309 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-05-22 09:26
Logged In: YES 
user_id=21627

None is not a keyword. Watch this:

>>> def None():pass
SyntaxError: assignment to None
>>> def while():pass
SyntaxError: invalid syntax
>>> 

None remains an identifier, but assignments to None are not
allowed.
msg50310 - (view) Author: Ziga Seilnacht (zseil) * (Python committer) Date: 2006-05-22 11:04
Logged In: YES 
user_id=1326842

I realise that None is a constant, not a keyword.
Could at least the documentation be changed?
Currently the reference manual says:

"The following identifiers are used as reserved words, or
keywords of the language, and cannot be used as ordinary
identifiers."

A list that doesn't include None follows, but as your
example shows, None also can't be used as an ordinary
identifier.
Later on that page:

"In some future version of Python, the identifier None
will become a keyword."

See:
http://docs.python.org/dev/ref/keywords.html
msg50311 - (view) Author: Ziga Seilnacht (zseil) * (Python committer) Date: 2006-05-22 13:13
Logged In: YES 
user_id=1326842

Attaching a new set of patches. Since they only affect
the documentation, I also changed the category. The
patch against the trunk also includes a note that
using "as" and "with" as identifiers will issue a
warning.
msg50312 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-05-26 20:17
Logged In: YES 
user_id=849994

Committed your patches in rev. 46411, 46412. Note that the
optional text in \versionchanged mustn't have a trailing
period though...
History
Date User Action Args
2022-04-11 14:56:17adminsetgithub: 43386
2006-05-20 20:43:10zseilcreate