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

X-Received by 10.43.69.18 with SMTP id ya18mr7244722icb.0.1413121565787; Sun, 12 Oct 2014 06:46:05 -0700 (PDT)
X-Received by 10.50.13.42 with SMTP id e10mr199064igc.14.1413121565478; Sun, 12 Oct 2014 06:46:05 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!uq10no9238558igb.0!news-out.google.com!rp1ni27119igb.0!nntp.google.com!uq10no9238528igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Sun, 12 Oct 2014 06:46:04 -0700 (PDT)
In-Reply-To <mailman.14784.1413118559.18130.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=59.95.12.147; posting-account=mBpa7woAAAAGLEWUUKpmbxm-Quu5D8ui
NNTP-Posting-Host 59.95.12.147
References <mailman.14784.1413118559.18130.python-list@python.org>
User-Agent G2/1.0
MIME-Version 1.0
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>
Injection-Date Sun, 12 Oct 2014 13:46:05 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.python:78997

Show key headers only | 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