arguments of a function/metaclass
michele.simionato at gmail.com
Tue Jan 16 17:21:34 CET 2007
rubbishemail at web.de wrote:
> I have a member function with many (20) named arguments
> def __init__(self,a=1,b=2):
> I would like to get rid of the many redundant lines like self.a=a and
> set the members automatically.
> The list of default arguments could be given like
> def __init__(**kwargs):
> if this makes things easier
> Of course there has to be a check that raises an error in case of an
> unknown argument not mentioned in this list.
> I am sure there is an elegant way how to do this, could you give me any
def __init__(self, **kw):
More information about the Python-list