I'm wrong or Will we fix the ducks limp?

Antoon Pardon antoon.pardon at rece.vub.ac.be
Thu Jun 9 06:19:35 EDT 2016


Op 09-06-16 om 11:19 schreef Marko Rauhamaa:
>
>> In a rather straight forward environment with classes/structs that
>> have an x and y attribute, the following lines behave differently
>> in C and Python.
>>
>>   A.x = 1;
>>   A.y = 2;
>>
>>   B = A;
>>
>>   B.x = 3;
>>   B.y = 4;
>>
>> In C the variable A will still be x:1, y:2.
>> In Python the variable A will be x:3, y:4.
>>
>> So no, Python doesn't do the exact same thing with variables as C.
> The difference is not in the variables but in the expressions. In
> Python,
>
>     1
>
> evaluates to a pointer; in C, it evaluates to an int. Furthermore, in
> Python,
>
>     A
>
> evaluates to a pointer; in C, it evaluates to a struct.

If a variable evaluates to something different, in different
languages, the variable don't do the exact same thing in
the different languages.



More information about the Python-list mailing list