@@ -62,10 +62,7 @@ def toprettyxml(self, indent="\t", newl="\n", encoding=None):
6262 return writer .stream .getvalue ()
6363
6464 def hasChildNodes (self ):
65- if self .childNodes :
66- return True
67- else :
68- return False
65+ return bool (self .childNodes )
6966
7067 def _get_childNodes (self ):
7168 return self .childNodes
@@ -930,6 +927,7 @@ class Childless:
930927 """Mixin that makes childless-ness easy to implement and avoids
931928 the complexity of the Node methods that deal with children.
932929 """
930+ __slots__ = ()
933931
934932 attributes = None
935933 childNodes = EmptyNodeList ()
@@ -1067,6 +1065,8 @@ def replaceData(self, offset, count, arg):
10671065
10681066
10691067class Text (CharacterData ):
1068+ __slots__ = ()
1069+
10701070 nodeType = Node .TEXT_NODE
10711071 nodeName = "#text"
10721072 attributes = None
@@ -1188,6 +1188,8 @@ def writexml(self, writer, indent="", addindent="", newl=""):
11881188
11891189
11901190class CDATASection (Text ):
1191+ __slots__ = ()
1192+
11911193 nodeType = Node .CDATA_SECTION_NODE
11921194 nodeName = "#cdata-section"
11931195
@@ -1266,8 +1268,7 @@ def __setstate__(self, state):
12661268class Identified :
12671269 """Mix-in class that supports the publicId and systemId attributes."""
12681270
1269- # XXX this does not work, this is an old-style class
1270- # __slots__ = 'publicId', 'systemId'
1271+ __slots__ = 'publicId' , 'systemId'
12711272
12721273 def _identified_mixin_init (self , publicId , systemId ):
12731274 self .publicId = publicId
0 commit comments