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

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


Op 09-06-16 om 13:46 schreef Julien Salort:
> Antoon Pardon <antoon.pardon at rece.vub.ac.be> wrote:
>
>>   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. 
> But it would, if you had written instead:
>
> A->x = 1;
> A->y = 2;
>
> B = A;
>
> B->x = 3;
> B->y = 4;
>
> which backs indeed the C pointer analogy...

Yes, what is your point? I know there is a C pointer analogy with
Python variables. The fact that there is an analogy between C pointers
and Python variables, is not enough to conclude that C variables and
Python variables behave exactly the same.

Normal structs are a kind of variable too in C. If you have to
ignore those in order to show similarities, then the variables
in general don't behave exactly the same.




More information about the Python-list mailing list