On Sat, Apr 17, 2010 at 11:09 PM, vsoler <vicente.so...@gmail.com> wrote:
> I have the following script: > > class TTT(object): > def duplica(self): > self.data *= 2 > def __init__(self, data): > self.data = data > TTT.duplica(self.data) > You're calling duplica with the class, and not by its object (self). self.duplica() will do what you want. Cheers, Xav > > 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? > -- > http://mail.python.org/mailman/listinfo/python-list >
-- http://mail.python.org/mailman/listinfo/python-list