[Tutor] attribute references unbound method

reavey reavey@nep.net
Thu Mar 6 17:50:18 2003


Mike Reavey wrote:


 >>>class MyClass:
           "a simple example"
            n = 1234
            def f(self):
                 print "hello"

 >>>MyClass.n
1234
 >>>MyClass.f
<unbound method MyClass.f>
 >>>MyClass.f(self)
NameError: name 'self' is not defined

I found this trying to learn class objects in the Python Tutorial 9.3.2
I know I'm doing something wrong, but can't put my finger on it.

thanks
re-v