Michael Bayer wrote:
what a drag.

this has some inconvenient effects on ResultProxy.

while __del__ will still be there and im pretty confident works just fine
in cPython, if you dont want to rely upon __del__ you will basically have
to do:

   r = table.select().execute()
   for row in r:
      ....
   r.close()

doing a "close" automatically at the end of the iteration isnt going to
work since the returned RowProxy is also bound to the underlying Cursor.

similarly, if you do a CRUD operation, the returned ResultProxy has a
handle on the Cursor.  so which would you prefer, that the ResultProxy
doesnt have the resulting Cursor on it ?  or that you have to say:

    r = table.update().execute(foo='bar')
    r.close()

?

I would not get too hung up on this issue, since Jython in sqlalchemy is going to require other work (like, an engine that works with jdbc).

I think what I'm trying to say is, please don't make __del__ the *only* mechanism for resource release.

Jython *will* call __del__, however *when* it gets called is up to the JVM and cannot be predicted as simply as "when refcount drops to 0 it's freed".

so, maybe offer "close" methods on objects that hold references to other resources... and have __del__ call those close methods, and make sure that multiple close calls are ok.. I think thats the most reasonable thing to do without going crazy, but still leaves open the opportunity for explicit resource release when needed.

I think this is a low priority issue.. maybe even just an advisory to keep in my when developing new code. I don't think it's worth acting on now to the detriment of more important work.

thanks




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to