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.

Author mpb
Recipients docs@python, mpb
Date 2013-10-29.20:31:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1383078691.36.0.6145513581.issue19438@psf.upfronthosting.co.za>
In-reply-to
Content
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:

[1] http://docs.python.org/3/library/stdtypes.html#index-2

[2] http://docs.python.org/3/library/constants.html#None

Link [2] 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.)

[3] http://docs.python.org/3/library/types.html

If NoneType is gone in Python 3, mention of NoneType should probably be removed from link [2].  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:

[4] http://docs.python.org/3/library/stdtypes.html#bltin-type-objects

"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 [4], and possibly elsewhere as well.)

Thanks!
History
Date User Action Args
2013-10-29 20:31:31mpbsetrecipients: + mpb, docs@python
2013-10-29 20:31:31mpbsetmessageid: <1383078691.36.0.6145513581.issue19438@psf.upfronthosting.co.za>
2013-10-29 20:31:31mpblinkissue19438 messages
2013-10-29 20:31:31mpbcreate