[Python-checkins] CVS: python/dist/src/Lib/xml/dom minidom.py,1.37,1.38

Fred L. Drake fdrake@users.sourceforge.net
2001年9月28日 13:25:47 -0700


Update of /cvsroot/python/python/dist/src/Lib/xml/dom
In directory usw-pr-cvs1:/tmp/cvs-serv27033/xml/dom
Modified Files:
	minidom.py 
Log Message:
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.
Index: minidom.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/minidom.py,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** minidom.py	2001年09月28日 04:33:06	1.37
--- minidom.py	2001年09月28日 20:25:45	1.38
***************
*** 31,47 ****
 
 import xml.dom
- _Node = xml.dom.Node
 
 
 if list is type([]):
 class NodeList(list):
 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
 
 else:
--- 31,46 ----
 
 import xml.dom
 
 
 if list is type([]):
 class NodeList(list):
+ __dynamic__ = 0
+ 
 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.")
 
 else:
***************
*** 50,54 ****
 
 
! class Node(_Node):
 allnodes = {}
 _debug = 0
--- 49,53 ----
 
 
! class Node(xml.dom.Node):
 allnodes = {}
 _debug = 0
***************
*** 57,64 ****
 childNodeTypes = ()
 namespaceURI = None # this is non-null only for elements and attributes
 
 def __init__(self):
 self.childNodes = NodeList()
- self.parentNode = self.ownerDocument = None
 if Node._debug:
 index = repr(id(self)) + repr(self.__class__)
--- 56,64 ----
 childNodeTypes = ()
 namespaceURI = None # this is non-null only for elements and attributes
+ parentNode = None
+ ownerDocument = None
 
 def __init__(self):
 self.childNodes = NodeList()
 if Node._debug:
 index = repr(id(self)) + repr(self.__class__)

AltStyle によって変換されたページ (->オリジナル) /