andrea.crotti.0 at gmail.com
Fri Sep 23 15:59:56 CEST 2011
Jean-Michel Pichavant <jeanmichel at sequans.com> writes:
> Did you consider subclassing your Var class ? This is how you extend a
> class behavior in OOP.
> class PSIVar(var):
> def __init__(self, name, desc, other=None, fun=None):
> var.__init__(self, name, desc)
> if other is not None:
> self.other = other
> self.fun = fun
> assert callable(self.fun)
> v1 = PSIVar('name', 'desc')
> that's it.
> By the way, don't create instance attribute conditionally. Your PSIVar
> instance should always have a 'other' attribute, its value can be None
Yes thanks, first I tried that, but I didn't want to have to change my
class definition if the one from the library changes. So I started to
mess with *args and **kwargs and it was really not beautiful ;)
Anyway since I want to other and more deep changes I just forked the
project and start work on that...
More information about the Python-list