Added nicer __repr__esentation to Wave and Folder objects
authorMerlijn van Deen (valhallasw) <valhallasw+prune@gmail.com>
Mon, 26 Sep 2011 08:39:53 +0000 (10:39 +0200)
committerMerlijn van Deen (valhallasw) <valhallasw+prune@gmail.com>
Mon, 26 Sep 2011 08:39:53 +0000 (10:39 +0200)
igor.py

diff --git a/igor.py b/igor.py
index 9c68111e8509e1eb3ce10c9fec43a2d2077d23e2..16704bea4194c69b63540df0ee4ce4f079537b3f 100644 (file)
--- a/igor.py
+++ b/igor.py
@@ -208,6 +208,8 @@ class Wave(ParseObject):
     def __array__(self):
         return self.data
         
+    __repr__ = __str__ = lambda s: u"<igor.Wave %s>" % s.format()
+        
 class Recreation(ParseObject):
     """
     Contains the experiment's recreation procedures as plain text.
@@ -279,6 +281,12 @@ class Folder(object):
                 if isinstance(r, (Folder,Wave)) and r.name == key:
                     return r
             raise KeyError("Folder %s does not exist"%key)
+            
+    def __str__(self):
+        return u"<igor.Folder %s>" % "/".join(self.path)
+    
+    __repr__ = __str__
+            
     def append(self, record):
         self.children.append(record)
     def format(self, indent=0):