Return value of an assignment statement?
Jeff Schwab
jeff at schwabcenter.com
Thu Feb 21 19:21:36 EST 2008
Steve Holden wrote:
> Jeff Schwab wrote:
>> bruno.desthuilliers at gmail.com wrote:
> [...]
>>> Now there's no reason to feel nervous about this. All you have to
>>> remember is that Python never copy anything unless explicitely asked
>>> for.
>>
>> It's not that simple. After a statement like:
>>
>> a = b
>>
>> Whether a and b denote the same object depends on what kind of object
>> b represented in the first place.
>
> Surely this is exactly wrong. Is there a single example you can think of
> where
>
> a = b
a += b (my bad)
> assert a is b, "Oops!"
>
> would raise and exception? Perhaps you meant to use an augmented
> assignment operation?
Why, yes I did! Sorry about that.
More information about the Python-list
mailing list