error when calling method of class

S

Sean Farrow

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.
Sean.
 
A

Andre Engels

2007/6/8 said:
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):
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,273
Latest member
DamonShoem

Latest Threads

Top