diff options
author | Fred Drake <fdrake@acm.org> | 2001-09-28 20:25:45 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2001-09-28 20:25:45 (GMT) |
commit | 575712eaca34cc8f9d712f690aec5442fe33031e (patch) | |
tree | 03a6ae04617a54b749be3d8153d9997d86b43214 /Lib | |
parent | 88a56857f65d98e9d2b670eab6e048bda519340a (diff) | |
download | cpython-575712eaca34cc8f9d712f690aec5442fe33031e.zip cpython-575712eaca34cc8f9d712f690aec5442fe33031e.tar.gz cpython-575712eaca34cc8f9d712f690aec5442fe33031e.tar.bz2 |
Tighten up the new NodeList implementation.
Clean up a little; do not create an alias that is only used once, or store
attributes with constant values in an instance.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/xml/dom/minidom.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/xml/dom/minidom.py b/Lib/xml/dom/minidom.py index 18b0e27..4bc83a5 100644 --- a/Lib/xml/dom/minidom.py +++ b/Lib/xml/dom/minidom.py @@ -30,36 +30,36 @@ except AttributeError: del types import xml.dom -_Node = xml.dom.Node if list is type([]): class NodeList(list): + __dynamic__ = 0 + def item(self, index): if 0 <= index < len(self): return self[index] - def __getattr__(self, name): - if name == "length": - return len(self) - raise AttributeError, name + length = property(lambda self: len(self), + doc="The number of nodes in the NodeList.") else: def NodeList(): return [] -class Node(_Node): +class Node(xml.dom.Node): allnodes = {} _debug = 0 _makeParentNodes = 1 debug = None childNodeTypes = () namespaceURI = None # this is non-null only for elements and attributes + parentNode = None + ownerDocument = None def __init__(self): self.childNodes = NodeList() - self.parentNode = self.ownerDocument = None if Node._debug: index = repr(id(self)) + repr(self.__class__) Node.allnodes[index] = repr(self.__dict__) |