educative.io

How is 'None' useful?

I have a question regarding this sentence: " We can assign None to any variable, but we can not create other NoneType variables."
What do you mean by “we can not create other ‘NoneType’ variables”?
How is ‘None’ useful?


Type your question above this line.

Course: https://www.educative.io/collection/10370001/5473789393502208
Lesson: https://www.educative.io/collection/page/10370001/5473789393502208/4863399451688960

1 Like

Hello @James7,

Type NoneType is for the None object, which means the object indicates no value. If a function does not return anything, its return type will be None. A search function that cannot find a match their common default return value will be None.
We can assign None to a variable but cannot create a variable of NoneType

This is what I am not getting.
" We can assign None to a variable but cannot create a variable of NoneType"

Do you mean for example if we want to create a variable with an integer from a string, we would do x= int(“7”), but with ‘None’ there’s no way we can convert a data type to ‘None’?

@James7, Yes! you get the point. We can only assign None to variables.

None is used to define a null value. It is not the same as an empty string, False, or a zero. It is a data type of the class NoneType object.

Assigning a value of None to a variable is one way to reset it to its original, empty state.

Happy learning.