All objects in Python, I think objects in this object and object-oriented programming should be different. Python in variables 1, ' A ', functions, classes, modules are objects, when using the type () function, for the above several objects will return a structure similar to the content of <type ' type ', where a is a defined function, B is the defined class.
>>> Print Type (a)'function'>>>> print type (b) ' Classobj '>>>> print type (1)'int'>
Python is a dynamic type language, where the application is detached from the object (not declaring its type when defining the variable, but applying the variable to the variable name when the value is assigned). The application here refers to the memory address, and the pointer is a bit similar. We use the name to represent the application, the variable name, the function name, the class name, and so on, using the ID () function to see the address value corresponding to the name. The object is the above-mentioned variable (1, ' a ', True), function, class, etc.
In Python everything is object, in-memory python should use the same method to manage various objects. An application is used to use an object, and an assignment statement can be seen as a link between an object and an app.
# variable, where only one object 1,A/B/C is an application of object 1 a=1< Span style= "color: #000000;" >b =1c =a # New object 2, at which point A is no longer an application of 1, but 2 of the application a=2# def F (): Span style= "color: #0000ff;" >print abc " f2 =f # at this time F becomes an application of the ' a ' object, no longer the application of the above function f= a
Python objects are maintained in memory with an app count, added when applied, and deleted when applied. When the count is 0 o'clock, it is possible to clear the memory occupied by the object. The purge or not is related to the object's contents and the GC settings in Python. A GC is a library of Python related to garbage collection.
Programming language Learning--python (1)