The composition and memory Python objects referenced by nature _ stack memory and heap memory, an identifier

A, python, everything all objects. Each object: identifier (identity), the type (type), value (value) Composition

       1. The identifier is used to uniquely identify an object, generally corresponds to the address in the computer memory. Using the built-in function id (obj) may return identifying objects.

       2. Type indicates the type of "data" stored objects. You can limit the type of object range and perform. Their type can use type (obj) to obtain the object.

       3. The information indicating the value of the stored data objects. Use print (obj) values ​​can be printed directly.

Second, the nature of the object is: a block of memory with a specific value, a specific type of support related operations.

Third, referenced 1 in Python, called objects referenced variables. Because the variable is stored in the address of the object, object reference variables address.

                 2. Variable located: stack memory, the object is located: heap memory

Four, python is a dynamically typed language

                  1. Variables do not need to declare the type of display. The object variable references, Python interpreter automatically determines the data type.              

Five, python is a strongly typed language

                  1. Each object has a data type, the type of support only supports.   

 VI identifier: name of variables, functions, modules, and the like. Identifier for a specific rule is as follows:

                  1. The case-sensitive: As abc and ABC are different

                  2. The first character must be a letter, an underscore character is followed by: letters, numbers, underscores.

                  3. You can not use keywords. Such as: if, or, while etc.

                  4. The one pair of beginning and ending offline names usually have a special meaning, to avoid such an approach. Such as: __ init__ the constructor    

 

 

 

                    

Guess you like

Origin www.cnblogs.com/yingxiongguixing/p/12163743.html