Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #78997

Re: TypeError: 'kwarg' is an invalid keyword argument for this function

Newsgroups comp.lang.python
Date 2014-10-12 06:46 -0700
References <mailman.14784.1413118559.18130.python-list@python.org>
Message-ID <b93efb73-97d8-4d3f-815f-523bfceebd83@googlegroups.com> (permalink)
Subject Re: TypeError: 'kwarg' is an invalid keyword argument for this function
From Rustom Mody <rustompmody@gmail.com>

Show all headers | View raw


Whats the problem??
Seems to work (python 2.7.8)

[Ive added a line so that that you can see]

class C:
   def __init__(self):
       pass

class C2(C):
    def __init__(self, *args, **kwargs):
        self.dic = kwargs
        pass
x = C2(kwarg='a')
y = C2(kwarg='a', kwarg2=8)


========================
>>> x.dic
{'kwarg': 'a'}
>>> y.dic
{'kwarg': 'a', 'kwarg2': 8}
>>> 

Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

TypeError: 'kwarg' is an invalid keyword argument for this function roro codeath <rorocodeath@gmail.com> - 2014-10-12 20:55 +0800
  Re: TypeError: 'kwarg' is an invalid keyword argument for this function Rustom Mody <rustompmody@gmail.com> - 2014-10-12 06:46 -0700

csiph-web