"RuntimeError: dictionary changed ... & Ruby

Alex Martelli aleaxit at yahoo.com
Tue Mar 14 03:44:26 CET 2006


Marc 'BlackJack' Rintsch <bj_666 at gmx.net> wrote:

> In <duvjsk$2r0f$1 at ulysses.news.tiscali.de>, robert wrote:
> 
> > * Ruby without refcounts provides no deterministic __del__ in 
> > non-circular refs ==> your type  finally finally finally .close .close
> > .close all the time
> 
> Which is what you should type in Python too as there's no guarantee that
> `__del__()` will be called immidiatly when the file object goes out of
> scope or isn't referenced anymore.  The reference counting memory
> management is an implementation detail.

Absolutely true -- which is why Python 2.5 adds a new `with' statement
that allows using the powerful idiom "resource acquisition is
initialization" without relying on any implementation details (yay!).


Alex



More information about the Python-list mailing list