[sapug] TypeError: __init__() got multiple values for keyword argument 'value'
chris at inetd.com.au
Tue Apr 29 06:20:06 CEST 2008
On Tue, 29 Apr 2008, Darryl Ross wrote:
> I'm sure I've worked out how to to this in the past, but the syntax is
> escaping me right now.
> class DooHicky(object):
> def __init__(self, arg1=None, arg2=None):
> class Thingo(DooHicky):
> def __init__(self, value=None, *args, **kwargs):
> self.value = value
> super(Thingo, self).__init__(self, *args, **kwargs)
> Basically, I want to pass in an argument to my "Thingo" class which does not
> get passed back to the parent constructor.
def __init__(self, arg1=None, arg2=None):
def __init__(self, **kwargs):
kwdict = kwargs
self.value = kwdict['value']
you would then need to always use keyword arguments, i.e.:
Thingo(arg1=5, arg2="gday", value="fred")
is that ok for you ?
Chris Foote <chris at inetd.com.au>
Inetd Pty Ltd T/A HostExpress
Phone: (08) 8410 4566
More information about the sapug