In this tutorial, you’ll learn about the NoneType object None, which acts as the null in Python. This object represents emptiness, and you can use it to mark default parameters and even show when you have no result. None is a tool for doing everything with nothing!
If you have experience with other programming languages, like C or Java, then you’ve probably heard of the concept of **null**
. Many languages use this to represent a pointer that doesn’t point to anything, to denote when a variable is empty, or to mark default parameters that you haven’t yet supplied. null
is often defined to be 0
in those languages, but null
in Python is different.
Python uses the keyword None
to define null
objects and variables. While None
does serve some of the same purposes as null
in other languages, it’s another beast entirely. As the null
in Python, None
is not defined to be 0
or any other value. In Python, None
is an object and a first-class citizen!
In this tutorial, you’ll learn:
**None**
is and how to test for itNone
as a default parameterNone
and NoneType
mean in your tracebackNone
in type checking**null**
in Python works under the hood#python #web-development #machine-learning