Re: "RuntimeError: dictionary changed ... & Ruby
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: "RuntimeError: dictionary changed ... & Ruby

From: Alex Martelli <aleaxit@yahoo.com>
Date: Tue Mar 14 2006 - 03:44:26 CET

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

> In <duvjsk$2r0f$1@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
Received on Sun Apr 30 11:46:51 2006