[SAGA-RG] SAGA Python language binding naming.

PFA van Zoolingen pzn400 at few.vu.nl
Fri Aug 15 05:08:28 CDT 2008


On Fri, 15 Aug 2008, Fisher, SM (Steve) wrote:

>>> I don't find that: bytes_read = f.read (buffer, len) is
>>> very pythonesqe. Surely it should be buffer = f.read()
>>> and len(buffer) will tell you what you have got.
>>
>> But how can you then specify that you want to read 20 bytes,
>> instead of the whole 20GB file?
>
> buffer = f.read(20)
> 
> I feel that the proposed calling sequence looks too C like
>

But how is the distinction made between saga-implementation managed 
buffers and application managed buffers?

If buffer is a saga managed one and you did a f.read(20), where does the 
data go?

> This seems an unnecessary complication - why not just change the
> PYTHONPATH to change implementation. I like the way the email package is
> structured into modules. You import what you need and you don't have
> strange things going on behind your back - potentially polluting your
> namespace.

Well, I use the environment variable for the name of the library. So 
multiple python-saga language bindings can exist in the same path. And for 
some reason jython does not use the PYTHONPATH variable. It uses a 
-Dpython.path flag which is given to the jvm. A separate variable is 
usable by everyone.

There is not much magic going on. It cuts the implementation name from 
saga.<imp_name>.package.class(). So you don;t have to rewrite your python 
program if you use a different implementation.

What do you mean with polluting the name space? All the saga classes might 
(well, probably are going to) be defined and loaded, but they all stay 
behind saga. I don't expect any other saga library to be loaded.

Paul.


More information about the saga-rg mailing list