[Python-Dev] PyFAQ: thread-safe interpreter operations

"Martin v. Löwis" martin at v.loewis.de
Tue Nov 21 07:09:25 CET 2006


Jean-Paul Calderone schrieb:
>> I'm uncertain whether D1.update(D2) will invoke callbacks (it
>> probably will).
> 
> Quite so:
> 
>     >>> class X:
>     ...     def __del__(self):
>     ...             print 'X.__del__'
>     ... 
>     >>> a = {1: X()}
>     >>> b = {1: 2}
>     >>> a.update(b)
>     X.__del__
>     >>> 

Ah, right: that's true for any assignment, then.

Regards,
Martin


More information about the Python-Dev mailing list