T
Tom Grove
Here is my version:
Python 2.4.3 (#2, May 9 2006, 21:56:54)
[GCC 3.4.4 [FreeBSD] 20050518] on freebsd6
I am trying the classes example from the tutorial because some other
class related stuff I am doing is not working either.
Straight from Chapter 9:
class MyClass:
"A simple example class"
i = 12345
def f(self):
return 'hello world'
From here I run:
x = MyClass
xf = x.f
while True:
print xf()
This gives the following error:
Traceback (most recent call last):
File "<stdin>", line 2, in ?
TypeError: unbound method f() must be called with MyClass instance as
first argument (got nothing instead)
Please help...this is killing me!
-Tom
Python 2.4.3 (#2, May 9 2006, 21:56:54)
[GCC 3.4.4 [FreeBSD] 20050518] on freebsd6
I am trying the classes example from the tutorial because some other
class related stuff I am doing is not working either.
Straight from Chapter 9:
class MyClass:
"A simple example class"
i = 12345
def f(self):
return 'hello world'
From here I run:
x = MyClass
xf = x.f
while True:
print xf()
This gives the following error:
Traceback (most recent call last):
File "<stdin>", line 2, in ?
TypeError: unbound method f() must be called with MyClass instance as
first argument (got nothing instead)
Please help...this is killing me!
-Tom