TypeError
Martijn
martijn_500 at hotmail.com
Tue Aug 28 16:54:08 EDT 2001
Martijn wrote:
> Hi,
>
> I`ve got this error every time I want to use my classes and I can`t
> figure out what`s wrong. My code is ok and I`ve used some examples from
> a book to check it but I get the same error message.This is what happends:
>
> >>> import MyClassFile
> >>> m = MyClassFunction()
> Traceback (innermost last)
> File "<stdin>"
> TypeError: Call of nonfunction (type module)
>
> I also tried:
>
> >>> import MyClassFile
> >>> m = MyClassFile.MyClassFunction()
>
> And finaly :
>
> >>> from MyClassfile import *
> >>> m = MyClassFunction()
>
> Both give me the same errors. What am i doing wrong ?!? I am using Linux
> btw.
>
>
> Thanx in advance,
>
>
> Martijn
It still doesn`t work. This is a code snippet example from Python 2.1 Bible:
class Wallet:
"where does my money go ?"
WalletCnt = 0
def __init__(self,balance = 0):
self.balance = balance
Wallet.WalletCnt = Wallet.WalletCnt + 1
def getPaid(self,amnt):
self.balance = self.balance +1
self.display()
def spend(self,amnt):
self.balance = self.balance -1
self.display()
def display:
print 'New Balance: $%.2f; % self.balance
More information about the Python-list
mailing list