error when calling method of class
Andre Engels
andreengels at gmail.com
Fri Jun 8 09:58:57 EDT 2007
2007/6/8, Sean Farrow <sean.farrow at seanfarrow.co.uk>:
> Hi:
> I have defined a class in that class is a method defined as follows:
> def splitTime(n):
> seconds =float(n)
> I call the method in another procedure as follows:
> sefl.splitTime(200)
> the traceback states that splitTime takes one argument two given. why is
> this occuring?
> if I try calling it like:
> splitTime(200)
> I get a name resultion error saying that the global name splitTime is
> not defined.
> Any help apreciated.
In self.splitTime(200), self is considered an argument as well, thus
the definition should be done with:
def splitTime(self,n):
--
Andre Engels, andreengels at gmail.com
ICQ: 6260644 -- Skype: a_engels
More information about the Python-list
mailing list