Calling a class method

Andreas Waldenburger usenot at geekmail.INVALID
Sat Apr 17 15:44:56 CEST 2010


On Sat, 17 Apr 2010 06:09:21 -0700 (PDT) vsoler
<vicente.soler at gmail.com> wrote:

> I got the following error:
> TypeError: unbound method duplica() must be called with TTT instance
> as first argument (got int instance instead)
> 
> What am I doing wrong?

Not reading the error message.

You need to create a TTT instance and call your method from that:

inst = TTT()
inst.duplica(7)


I notice you ask a lot of very basic beginner questions. While there
is nothing wrong with being a beginner and asking questions, I think you
should read more introductory material and tutorials. Concerning
classes, pick one of the following that you like:

http://www.google.com/search?ie=UTF-8&q=python%20classes%20introduction
(Yes I am teasing you a bit ;) )

Also, maybe you'd like to post to the tutor list[1], which is (to my
understanding) intended for just this kind of question.

[1]: http://mail.python.org/mailman/listinfo/tutor

best
/W


-- 
INVALID? DE!




More information about the Python-list mailing list