[SAGA-RG] Python SAGA language bindings: how to express explicit object destruction?
Andre Merzky
andre at merzky.net
Wed Dec 9 10:10:47 CST 2009
+1 for close()
Also, we have close on other objects which need
explicit resource freeing before destruction (see 2.5.4 and 2.5.5 of
GFD.90).
Best, Andre.
Quoting [Thilo Kielmann] (Dec 09 2009):
> Cc: Manuel Franceschini <livewire at koltern.com>,
> Andre Merzky <andre at merzky.net>, Hartmut Kaiser <hkaiser at cct.lsu.edu>,
> SAGA RG <saga-rg at ogf.org>
> From: Thilo Kielmann <kielmann at cs.vu.nl>
> To: Mathijs den Burger <mathijs at cs.vu.nl>
> Subject: Re: Python SAGA language bindings: how to express explicit object
> destruction?
> Date: Wed, 9 Dec 2009 16:43:38 +0100
>
>
> (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/
--
Nothing is ever easy.
More information about the saga-rg
mailing list