Calling a class method
steve at REMOVE-THIS-cybersource.com.au
Sat Apr 17 16:16:17 CEST 2010
On Sat, 17 Apr 2010 15:44:56 +0200, Andreas Waldenburger wrote:
> 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()
He already has a TTT instance. Since he's calling the TTT.duplica method
from another TTT method, the easiest way (and the most Pythonic, and the
most sensible, is to do this:
Calling duplica from the class as TTT.duplica will work, if he does:
but why would you want to?
More information about the Python-list