changeset 35:00ee3db419a9

ElementTree - Remove text property, the value is static anyway
author Bastian Blank <bblank@thinkmo.de>
date Mon, 14 Jul 2008 14:22:22 +0200
parents 296964441d48
children 29ab13148a54
files emeraldtree/ElementTree.py
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/emeraldtree/ElementTree.py	Mon Jul 14 12:37:26 2008 +0200
+++ b/emeraldtree/ElementTree.py	Mon Jul 14 14:22:22 2008 +0200
@@ -474,6 +474,8 @@
 # @return An opaque object, representing the QName.
 
 class QName(object):
+    __slots__ = 'text', 'name', 'uri'
+
     def __init__(self, text, uri=None):
         text = unicode(text)
         if text[0] == '{':
@@ -486,6 +488,11 @@
             text = text[i + 1:]
         self.name, self.uri = text, uri
 
+        if self.uri is not None:
+            self.text = '{' + self.uri + '}' + self.name
+        else:
+            self.text = self.name
+
     def __repr__(self):
         return '%s(%r, %r)' % (self.__class__.__name__, self.name, self.uri)
 
@@ -506,12 +513,6 @@
     def copy(self):
         return self.__class__(self.name, self.uri)
 
-    @property
-    def text(self):
-        if self.uri is not None:
-            return '{' + self.uri + '}' + self.name
-        return self.name
-
 # --------------------------------------------------------------------
 
 ##