On 2006-0925 10:27:16, M.-A. Lemburg wrote:
> Sounds reasonable, though strictly speaking, the with-container
> is not necessary, since cursors and connections will close themselves
> when garbage collected, ie. as soon as they go out of scope.

this (garbage collected as soon as they go out of scope) is more
implementation dependent than absolutely true...

the garbage collector is activated "when it feels like", and will
collect all garbage, or maybe just as much garbage as it is given time
to..., again depending on the implementation and the situation.

I don't know how much determinism is desired, but the with construct can
introduce quite a lot of it.

> In some cases it may not even be desirable to close the cursor or
> connection, since this prevents effective debugging (the traceback
> passed to outer scopes will contain a reference to the cursor and
> connection, keeping them open).

in this case the user would not use the with construct and take care
that the connection / cursor do not get garbage collected...

as usual, getting lost in details.

I really like this new construct and taking advantage of it seems to me
the right thing to do.

Mario

-- 
"S'il y a un Dieu, l'athéisme doit lui sembler une moindre injure 
 que la religion."
  -- Edmond et Jules de Goncourt
_______________________________________________
DB-SIG maillist  -  DB-SIG@python.org
http://mail.python.org/mailman/listinfo/db-sig

Reply via email to