Re: dictionary with object's method as thier items

2006-08-30 Thread Bruno Desthuilliers
noro wrote: > great that is what i looked for. Hmmm... Not quite sure class C: >> ... def function(self, arg): >> ... print arg >> ... >> >>> obj = C() >> >>> d = C.__dict__ >> >>> d['function'](obj, 42) >> 42 > > this allows me the access the same method in a range of object

Re: dictionary with object's method as thier items

2006-08-30 Thread noro
great that is what i looked for. >>> class C: > ... def function(self, arg): > ... print arg > ... > >>> obj = C() > >>> d = C.__dict__ > >>> d['function'](obj, 42) > 42 this allows me the access the same method in a range of objects. i can put all the functions i need in a dictio

Re: dictionary with object's method as thier items

2006-08-30 Thread Gabriel Genellina
At Wednesday 30/8/2006 10:35, noro wrote: for a certain class: by some way create a dictionary that look somthing like that: d= {'function one': , \ 'function two': , \ 'function three': } and so i could access every method of instances of C, such as obj with sometiing like: (i kno

Re: dictionary with object's method as thier items

2006-08-30 Thread Georg Brandl
noro wrote: > Is it possible to do the following: > > for a certain class: > > > class C: > > def func1(self): > pass > def func2(self): > pass > def func4(self): > pass > > obj=C() > > > by some w

Re: dictionary with object's method as thier items

2006-08-30 Thread Bruno Desthuilliers
noro wrote: > Is it possible to do the following: > > for a certain class: > > > class C: > > def func1(self): > pass > def func2(self): > pass > def func4(self): > pass > > obj=C() > > > by some w

Re: dictionary with object's method as thier items

2006-08-30 Thread Roberto Bonvallet
noro wrote: > Is it possible to do the following: > > for a certain class: [...] > by some way create a dictionary that look somthing like that: > > d= {'function one': , \ > 'function two': , \ > 'function three': } > > and so i could access every method of instances of C Something l

Re: dictionary with object's method as thier items

2006-08-30 Thread John Purser
On 30 Aug 2006 06:35:17 -0700 "noro" <[EMAIL PROTECTED]> wrote: > Is it possible to do the following: > > for a certain class: > > > class C: > > def func1(self): > pass > def func2(self): > pass > def func4(self): > pass > >

dictionary with object's method as thier items

2006-08-30 Thread noro
Is it possible to do the following: for a certain class: class C: def func1(self): pass def func2(self): pass def func4(self): pass obj=C() by some way create a dictionary that look somthing like t