can't find the right simplification
mabdelkader at gmail.com
Fri Apr 24 02:20:31 CEST 2009
Not sure I understand what is self.P, but look at the __getitem__ and
--Sent from my iPhone
On Apr 23, 2009, at 7:10 PM, Stef Mientki <stef.mientki at gmail.com>
> I've a program where you can connect snippets of code (which I call
> a "Brick") together to create a program.
> To make it easier to create these code snippets, I need some
> For simple parameters ( integer, tupple, list etc) this works ok,
> and is done like this:
> class _Simple_Par ( object ) :
> Class to make it more easy to set a Bricks.Par from a control.
> So instead of :
> self.Brick.Par [ self.EP ] = Some_Value
> you can write
> self.P = Some_Value
> def __init__ ( self, control ) :
> self.Control = control
> def __setitem__ ( self, index, value ) :
> i = self.Control.EP [ index ]
> if i :
> self.Control.Brick.Par [ i ] = value
> Now I want a similar simplification for the case that Par is a
> So instead of writing:
> self.Brick.Par [ self.EP ] [ 'Filename' ] = Some_Value
> I would like to write:
> self.P [ 'Filename' ] = Some_Value
> But I can't figure out how to accomplish that ?
> Any suggestions ?
> Stef Mientki
More information about the Python-list