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


Groups > comp.lang.python > #32033 > unrolled thread

Re: classes

Started byChris Angelico <rosuav@gmail.com>
First post2012-10-24 23:39 +1100
Last post2012-10-24 23:39 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: classes Chris Angelico <rosuav@gmail.com> - 2012-10-24 23:39 +1100

#32033 — Re: classes

FromChris Angelico <rosuav@gmail.com>
Date2012-10-24 23:39 +1100
SubjectRe: classes
Message-ID<mailman.2756.1351082388.27098.python-list@python.org>
On Wed, Oct 24, 2012 at 11:11 PM, inshu chauhan <insideshoes@gmail.com> wrote:
> print " Adding twice of %4.2f gives " % (y.addtwice())
>
>
> Error is :
>
> Traceback (most recent call last):
>   File "Z:\learning Python\learn5.py", line 35, in <module>
>     print " Adding twice of %4.2f gives " % (y.addtwice())
> TypeError: addtwice() takes exactly 2 arguments (1 given)
>
> why the prog is having this error with self nd x as arguments ???

The first argument is 'self', which is being passed y, but you also
need to pass it a value to add twice. You're ignoring the argument to
__init__ so I don't know what your purpose is, but possibly you should
be saving that into self somewhere??

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web