anything like C++ references?
Stephen Horne
intentionally at blank.co.uk
Sun Jul 13 22:41:46 EDT 2003
On 13 Jul 2003 21:40:32 -0400, aahz at pythoncraft.com (Aahz) wrote:
>In article <usmp9q5s6.fsf at boost-consulting.com>,
>>All you guys must be forgetting:
>>
>> >>> a = [1]
>> >>> b = a
>> >>> a += b
>> >>> assert id(a) == id(b)
>> >>> a = 1
>> >>> b = a
>> >>> a += b
>> >>> assert id(a) == id(b)
>> Traceback...
>
>I'm not forgetting that. It's an unfortunate and tricky part of Python
>semantics in some respects, but it's easily explained and understood if
>you focus on the objects rather than the operation:
I wish I'd thought of it, though - I could have avoided the
'boneheaded' confession a bit longer ;-)
More information about the Python-list
mailing list