[SAGA-RG] Python SAGA language bindings: how to express explicit object destruction?

Thilo Kielmann kielmann at cs.vu.nl
Wed Dec 9 09:43:38 CST 2009


(Added the SAGA mailing list to this thread.)

My two cents are:

looks like in languages wirth garbage collection (Java and also Python),
we need to have a close() method to achieve a side effect on the remote
middleware.

If it is the right thing for Java, then it is also the right thing for  
Python.


Thilo

On Dec 9, 2009, at 3:53 PM, Mathijs den Burger wrote:

> Hi all,
>
> We may have overlooked something in the Python SAGA language bindings:
> how to express explicit object destruction.
>
> The root problem is that many backends have to be stopped  
> explicitly. An
> example is the XtreemOS job submission system, but many others exist  
> as
> well.
>
> For cleanup, SAGA defines destructors. However, this does not work in
> languages that do not support explicit object destruction (e.g. Java).
> The Java language bindings therefore added the method session.close(),
> which explicitly closes all running middleware that uses that session.
>
> Python contains a 'del' statement. However, that is not the same as a
> 'delete' in C++. The 'del' in Python only decreases a refcount.  
> Relying
> on Python's destructors (e.g. the __del__ methods in an object) can
> therefore be tricky [1], and makes it not very well suited to shutdown
> middleware.
>
> So: should we add a session.close() method to the Python language
> bindings as well?
>
> best,
> -Mathijs
>
>
> [1]
> http://www.electricmonk.nl/log/2008/07/07/python-destructor-and-garbage-collection-notes/
>
>
>

--
Thilo Kielmann
http://www.cs.vu.nl/~kielmann/






More information about the saga-rg mailing list