What represents an empty type in python?
None in python represents an empty type. Indicates that the value is an empty object. The empty value is a special value in Python, represented by None. None cannot be understood as 0, because 0 is meaningful, and None is a special null value. You can assign None to any variable, and you can assign None to variables with a value of None.
Related introduction:
In Python, everything is an object, and all operations are targeted at objects. So what is an object? 5 is an int object, 'oblong' is a str object, and exception is also an object. Abstractly, people, cats, etc. are also objects.
Then for an object, it has two characteristics. :
Attribute: to describe its characteristics
Method: the behavior it has
So, object = attribute method (in fact, method is also an attribute, a callable attribute that is different from data attributes)
Class: Objects with the same properties and methods can be classified into one category, that is, class. Multiple object instances can be created using one class, that is, humans, cats, and dogs all belong to the mammal class. A class is an abstraction of an object, and an object is an instantiation of a class. Classes do not represent specific things, but objects represent specific things.
Classes also have attributes and methods.
Data types are also objects
In fact, Pyhton only has the concept of objects during object-oriented programming, and when designing process-oriented programming, we discuss The most common thing is the data type.
The basic data types provided by Python mainly include: Boolean type, integer type, floating point type, string, list, tuple, set, dictionary, etc.
The entire data type can also be regarded as a "class". Each data type is an object and has its own properties and methods
Related recommendations: "Python Tutorial"
The above is the detailed content of What represents an empty type in python. For more information, please follow other related articles on the PHP Chinese website!