[SAGA-RG] SAGA attributes as Python dictionaries?

Manuel Franceschini livewire at koltern.com
Thu Nov 5 09:11:47 CST 2009


On Thu, Nov 5, 2009 at 2:55 PM, Mathijs den Burger <mathijs at cs.vu.nl> wrote:
> On Thu, 2009-11-05 at 07:27 -0600, Hartmut Kaiser wrote:
>
>> So here it goes again:
>>
>> Well, I stand corrected, it _is_ possible by overloading
>> __getattr__/__setattr__.
>
> Interesting! But wouldn't that become a bit hackish, with many possible
> side-effects?

__getattr__() is only called if an (Python) instance attribute is not
found via the standard lookup mechanism. __setattr__(), however, is
called for every (Python) instance attribute assignment. To overload
these methods has the potential of causing some trouble and overhead.
In __setattr__() every attribute assignment would need to be checked
against the list of valid SAGA attributes.


Cheers,
-- 
/Manuel


More information about the saga-rg mailing list