[New-bugs-announce] [issue19438] Where is NoneType in Python 3?
report at bugs.python.org
Tue Oct 29 21:31:31 CET 2013
New submission from mpb:
types.NoneType seems to have disappeared in Python 3. This is probably intentional, but I cannot figure out how to test if a variable is of type NoneType in Python 3.
Specifically, I want to write:
assert type (v) in ( bytes, types.NoneType )
Yes, I could write:
assert v is None or type (v) is bytes
But the first assert statement is easier to read (IMO).
Here are links to various Python 3 documentation about None:
Link  says: "None The sole value of the type NoneType." However, NoneType is not listed in the Python 3 documentation index. (As compared with the Python 2 index, where NoneType is listed.)
If NoneType is gone in Python 3, mention of NoneType should probably be removed from link . If NoneType is present in Python 3, the docs (presumably at least one of the above links, and hopefully also the index) should tell me how to use it.
Here is another link:
"The standard module types defines names for all standard built-in types." (Except <class 'NoneType'> ???)
None is a built-in constant. It has a type. If None's type is not considered to be a "standard built-in type", then IMO this is surprising(!!) and should be documented somewhere (for example, at link , and possibly elsewhere as well.)
assignee: docs at python
nosy: docs at python, mpb
title: Where is NoneType in Python 3?
versions: Python 3.3
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce