tough-to-explain Python
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Tue Jul 7 22:03:16 EDT 2009
On Tue, 07 Jul 2009 21:18:53 +0000, kj wrote:
> I had not realized how *profoundly* different the meaning of the "=" in
> Python's
>
> spam = ham
>
> is from the "=" in its
>
> spam[3] = ham[3]
>
> So much for "explicit is better than implicit"...
I'm sorry, I don't get it. Can you explain please? I don't see why it's
so "profoundly" different. Apart from spam[3] = x not being permitted if
spam is an immutable type.
I suppose though they are *fundamentally* different, in that spam=ham is
dealt with by the compiler while spam[3]=ham is handled by the object
spam using the __setitem__ method. Is that the difference you're talking
about?
--
Steven
More information about the Python-list
mailing list