Python Forum
where is NoneType defined?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
where is NoneType defined?
#1
where is NoneType defined or is NoneType = type(None) the only way to get it?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
As far as I know, type(None) is the normal way to get it. It is a singleton type:
>>> t = type(None)
>>> t() is None
True
In CPython, it is defined in object.c in the source tree: see the lines PyTypeObject _PyNone_Type = ...
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020