The meaning of "=" (Was: tough-to-explain Python)

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Thu Jul 9 21:05:01 EDT 2009


In message <h3291j$mfu$1 at reader1.panix.com>, kj wrote:

> .., Lundh writes:
> 
>   Assignment statements modify namespaces, not objects.

<counterexample>

    >>> a = [3]
    >>> b = a

These may indeed modify a namespace, not any object. However:

    >>> a[:] = [4]
    >>> a
    [4]
    >>> b
    [4]

What change has happened to the namespace in this case? None. Yet an object 
has changed.

</counterexample>




More information about the Python-list mailing list