[Bf-python] Const dict arguments

Ken Hughes khughes at pacific.edu
Wed Jul 20 16:06:39 CEST 2005


Stephen Swaney wrote:
> On Tue, Jul 19, 2005 at 02:43:15PM -0700, Ken Hughes wrote:
> 
>>I agree with the const dicts, but I foresee a problem with backward 
>>compatibility for getters.  We can make x.setStuff() accept the old
>>and new argument types, but what type should x.getStuff() return
>>(same applies to "val = x.stuff")?  Should we leave well enough alone?
>>Should there be an attribute x.paramType which the user can set to
>>use const dicts instead?
> 
> For now, we will leave the x.getStuff() interface alone and focus on
> the tp_getset methods.  The x.getStuff() code will be our legacy API.
> Over time, this will become deprecated and the direct attribute access
> will be our preferred interface.  This will probably mean some
> duplicated code, but we can live with that.

Ok, so should all the existing x.getStuff()/x.setStuff() use the 
tp_getset and we ignore const dicts for now, and fix the mixture of 
const dicts, strings, lists, units, etc., in a later pass through the 
code?  Or should all the new tp_getset methods use const dicts, meaning 
that some of the existing x.getStuff()/x.setStuff() methods will not 
just call the appropriate method from the PyGetSetDef table (the one for 
the tp_getset slot) if they don't use const dicts?

Ken



More information about the Bf-python mailing list