"Aurélien Campéas" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

> I mean : aren't C variables also bindings from names to objects ? Or what 
> ?

No, they're not.

In C, when you execute

    x = y;

you cause x to become a copy of y.  In Python, when you execute

    x = y

you cause x and y to be two different names for the same object.

It is difficult to distinguish these cases unless the objects in question 
are mutable, so consider this C example:

    struct {int a, b;} x = {3, 4}, y = x;
    x.a = 42
    printf ("%d, %d\n", y.a, y.b);

and the following apparently analogous Python example:

    x = [3, 4]
    y = x
    x[0] = 42
    print y

Try them both and see how they behave.



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to