Re: dictionary as property

2005-07-20 Thread Benjamin Niemann
Thanos Tsouanas wrote: Hello. (How) can I have a class property d, such that d['foo'] = 'bar' will run a certain function of the class with 'foo' and 'bar' as it's arguments? I think you mean: class A: def __init__(self): self.d = {} def dict_change(self, key, value): print

dictionary as property

2005-07-19 Thread Thanos Tsouanas
Hello. (How) can I have a class property d, such that d['foo'] = 'bar' will run a certain function of the class with 'foo' and 'bar' as it's arguments? Thanks in advance. -- Thanos Tsouanas .: My Music: http://www.thanostsouanas.com/ http://thanos.sians.org/ .: Sians Music:

Re: dictionary as property

2005-07-19 Thread Gerhard Haering
On Tue, Jul 19, 2005 at 07:56:20PM +0300, Thanos Tsouanas wrote: Hello. (How) can I have a class property d, such that d['foo'] = 'bar' will run a certain function of the class with 'foo' and 'bar' as it's arguments? You could implement a custom container type that will do what you want. See

Re: dictionary as property

2005-07-19 Thread Thanos Tsouanas
On Tue, Jul 19, 2005 at 07:00:10PM +0200, Gerhard Haering wrote: On Tue, Jul 19, 2005 at 07:56:20PM +0300, Thanos Tsouanas wrote: Hello. (How) can I have a class property d, such that d['foo'] = 'bar' will run a certain function of the class with 'foo' and 'bar' as it's arguments? You