no change - various tweaks here and there
[sfa.git] / sfa / rspecs / elements / element.py
index e185490..df46c89 100644 (file)
@@ -2,7 +2,8 @@ class Element(dict):
 
     fields = {}
 
-    def __init__(self, fields={}, element=None, keys=None):
+    def __init__(self, fields=None, element=None, keys=None):
+        if fields is None: fields={}
         self.element = element
         dict.__init__(self, dict.fromkeys(self.fields))
         if not keys:
@@ -13,9 +14,10 @@ class Element(dict):
 
 
     def __getattr__(self, name):
-        if hasattr(self, name):
-            return getattr(self, name)
+        if hasattr(self.__dict__, name):
+            return getattr(self.__dict__, name)
         elif hasattr(self.element, name):
             return getattr(self.element, name)
         else:
-            raise AttributeError, "class Element has not attribute %s" % name
+            raise AttributeError("class Element of type {} has no attribute {}"
+                                  .format(self.__class__.__name__, name))