The following code snippet is meant to test inheritance:
class test:
def __init__(self,v):
self.__val = v
def val(self):
print self.__val
class sub(test):
def __init__(self):
val()
The following console session has an error:
>>> T = mylib.test('hello')
>>> s = mylib.sub()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "mylib.py", line 1612, in __init__
val()
NameError: global name 'val' is not defined
## what do I need to do to make the 'test method visible
## class 'sub?
thanks
tim
--
Tim Johnson <[EMAIL PROTECTED]>
http://www.alaska-internet-solutions.com
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor