newbie class question
Ron Johnson, Jr.
ronjohn at gs.verio.net
Sun Aug 13 16:44:48 EDT 2000
What am I doing wrong when trying tp access the method f() ?
>>> class MyClass:
... i = 12345
... def f(x):
... return 'hello world'
>>> x = MyClass
>>> print x.i
12345
>>> print x.f(1)
Traceback (innermost last):
File "<stdin>", line 1, in ?
TypeError: unbound method must be called with class instance 1st
argument
>>> print x.f(self)
Traceback (innermost last):
File "<stdin>", line 1, in ?
NameError:
self
Sincerely,
Ron
--
+----------------------------------------------------------+
| Ron Johnson, Jr. Home: ronjohn at gs.verio.net |
| Jefferson, LA USA WWW : ronjohnsonjr at yahoo.com |
| |
| Most overused words: feel, cool/kewl, fun, myBlah.com |
| Most underused word: think |
+----------------------------------------------------------+
More information about the Python-list
mailing list