thank you guys... I've chosen to always use keyword arguments and add **kwargs to the parameters of __init__ of the derived class and then pass it to the super inside __init__, I think it's not that much weird to do...
cheers... E.Ozgur Yilmaz Lead Technical Director eoyilmaz.blogspot.com www.ozgurfx.com On Wed, Oct 27, 2010 at 9:45 PM, Viktoras <[email protected]> wrote: > I actually like design when constructors use as little arguments as > possible, ideally none at all - this benefits your later when you can > instantiate objects prior to knowing all the initialization parameters. When > you absolutely have to use arguments for constructors, it's best when child > class can assure that parent constructor will receive valid arguments no > matter how child's constructor gets called. In your case, the valid ways to > extend constructor with required arguments are either: > > # add one more argument to child constructor > def__init__(arg1,arg2,arg3): > AClass.__init__(arg1,arg2) > > > or > > # reduce amount of arguments via supplying value from elsewhere > def__init__(arg2,arg3): > AClass.__init__("iAlreadyKnowArg1ValueAtConstructionTime",arg2) > > > > > On 2010.10.27 14:55, Erkan Özgür Yılmaz wrote: > >> >> so my question is, is it good/safe/nice to use *args, **kwargs and pass >> them to the super of BClass to avoid repeating the arguments of the parent >> class (AClass)? >> > > -- > Viktoras > www.neglostyti.com > > > -- > http://groups.google.com/group/python_inside_maya > -- http://groups.google.com/group/python_inside_maya
