Want - but cannot get - a nested class to inherit from outer class

DBak davidbak at gmail.com
Fri Mar 7 16:07:21 EST 2008


Sorry - code for the class should read:

class Tree(object):
...class _MT(Tree):
......def isEmpty(self): return True
......def insert(self, X): return Tree._Node(X)
...class _Node(Tree):
......def isEmpty(self): return False
......def insert(self, X): return _Node(X, self, Tree._MT())
...def __init__(): return _MT()
...def merge(self, T):
......<code for merging tree T into self>



More information about the Python-list mailing list