Oct. 24, 2001
1:30 a.m.
akuchlin@mems-exchange.org writes:
Oh, well; I need to come up with a different example for subclassing a built-in type, then. Thanks! <puts on thinking cap>
Andrew, You can take a look at that implementation of xml.dom.minidom.NodeList; for Python 2.2, the implementation goes like this: ---------------------------------------------------------------------- class NodeList(list): def item(self, index): if 0 <= index < len(self): return self[index] length = property(lambda self: len(self), doc="The number of nodes in the NodeList.") ---------------------------------------------------------------------- -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> PythonLabs at Zope Corporation