[SAGA-RG] SAGA attributes as Python dictionaries?

Andre Merzky andre at merzky.net
Wed Nov 4 12:48:00 CST 2009


Quoting [Ole Christian Weidner] (Nov 04 2009):
> 
> Hi,
> 
> slightly off-topic, but where can I actually download VU's Python  
> bindings?

According to Mathijs, from a different mail (which you should have
seen):

> The easiest is to checkout the whole PySaga repository, which                                                   
> contains the language bindings (in /spec/trunk), the implementation on                                                
> top of Java (in /impl/jysaga/trunk) and the python-cpp wrapper                                                        
> (in /impl/cppysaga/trunk). The svn url is:                                                                            
>                                                                                                                       
> https://gforge.cs.vu.nl/svn/pysaga                                                                                    
>                                                                                                                       
> You have read-only access with user 'anonymous' and an empty password.                                                
> Manuel (cc'd) knows all the details of the python-cpp wrapper code.

Cheers, Andre.


> Cheers,
> Ole
> 
> On Nov 4, 2009, at 9:48 AM, Mathijs den Burger wrote:
> 
> > Hi all,
> >
> > For the Python language bindings, we (at the VU) are thinking about
> > CCT's idea to use the Python 'dict' interface for SAGA attributes.  
> > While
> > we like the idea to use Python-specific constructs in the language
> > bindings, it seems that SAGA attributes differ in semantics from the
> > 'associative arrays' that are Python's dictionaries.
> >
> > Some examples where Python dicts and SAGA attributes differ:
> >
> > 1. They throw different exceptions (e.g. KeyError vs BadParameter /
> > PermissionDenied / DoesNotExist / AuthenticationFailed /
> > AuthorizationFailed / BadParameter / IncorrectState / NoSuccess)
> >
> > 2. Removing SAGA attributes is permanent (AFAIK when talking to  
> > Ceriel),
> > while a deleted dict item can be re-added latter
> >
> > 3. Dictionaries accept any hashable object, whereas SAGA attributes  
> > only
> > accept a set of defined values.
> >
> > Exposing SAGA attributes as a dictionary may therefore lead to
> > confusion, as the two are similar but not identical.
> >
> > Another option for easy access (which we use in our implementation on
> > top of Java SAGA) is to use Python's 'property' construct for each
> > defined attribute. This allows you to do, for example:
> >
> >>>> from saga import job
> >>>> js = job.JobDescription()
> >>>> js.Executable = "/bin/date"
> >>>> js.Arguments = [ "-R" ]
> >
> > Python translates such property access to calling getter an setter
> > functions that can do additional checking. Very flexible, and the  
> > syntax
> > is even shorter than using the 'dict' interface. Wouldn't that be a
> > better option for easy access to SAGA attributes in Python?
> >
> > best,
> > Mathijs
> >
> >
> > --
> >  saga-rg mailing list
> >  saga-rg at ogf.org
> >  http://www.ogf.org/mailman/listinfo/saga-rg
-- 
Nothing is ever easy.


More information about the saga-rg mailing list