In Python, "NoneType" is the data type for the built-in constant "None" (which implies absence of value). None is the only instance of the NoneType type:
print(type(None)) # <class 'NoneType'>
The NoneType is not available in some versions of Python (as noted below):
- Python 2.7:
NoneTypeis defined as a type in the types module; - Python 3.0 - 3.9:
NoneTypeis removed from the types module (however, it's accessible viatype(None)); - Python 3.10:
NoneTypeis added back to the types module.
This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.