Calling a class method

vsoler vicente.soler at
Sat Apr 17 15:09:21 CEST 2010

I have the following script:

class TTT(object):
    def duplica(self): *= 2
    def __init__(self, data): = data
    def __str__(self):
        return str(

print obj

And I want 14 printed (twice 7)

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?

More information about the Python-list mailing list