1.if/else,try,while does not produce a new scope
Unlike Java,c, Python has only class and module to create new variable scopes, such as the following code, which makes the JAVA,C programmer very puzzled.
>>if A is None:
>> x=3
>>print x
2. Why Python variables look like there are no type restrictions, such as the following code
>>a= ' String '
>>a=111
In the Python world, everything is an object, even a function. So the above code is actually an object reference, the right value is the generated object, that is, a point to a new object, so the code does not error. But there are still types of objects, such as
>>a= ' string ' +111 does not work because a string object cannot drink an integer object to add.
In the eyes of C + + programs, you can actually understand
Object *a= new Int (111);
Object *a= New String (' string ');
Can be seen as variable A can also be understood as a type, except that the type is general-purpose
3. Whether the function parameter is passed as a value or a reference
If a function receives a reference to a mutable object (such as a dictionary or a list), it can modify the original value of the object-the equivalent of passing the object through a "pass reference". If the function receives a reference to an immutable object, such as a number, character, or tuple,
You cannot modify the original object directly-it is equivalent to passing the object through a "pass value".
C Programmer's doubts about Python