summaryrefslogtreecommitdiff
path: root/numpy/core/getlimits.py
diff options
context:
space:
mode:
authorBrent Pedersen <bpederse@gmail.com>2011-08-16 16:41:48 -0600
committerRalf Gommers <ralf.gommers@googlemail.com>2011-08-18 09:06:21 +0200
commit00962c4b845ec461e38850f8ae17253a4eecabf2 (patch)
tree1040ab5f2dbcb5f4045c5be4613fa7e7e8fb6915 /numpy/core/getlimits.py
parent43862759384a86cb4a95e8adb4d39fa1522acb28 (diff)
downloadnumpy-00962c4b845ec461e38850f8ae17253a4eecabf2.tar.gz
ENH: add useful repr's for finfo, iinfo.
Diffstat (limited to 'numpy/core/getlimits.py')
-rw-r--r--numpy/core/getlimits.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/numpy/core/getlimits.py b/numpy/core/getlimits.py
index 0cb1fd7f4..4754975e2 100644
--- a/numpy/core/getlimits.py
+++ b/numpy/core/getlimits.py
@@ -180,6 +180,14 @@ nexp =%(nexp)6s min= -max
---------------------------------------------------------------------
''' % self.__dict__
+ def __repr__(self):
+ c = self.__class__.__name__
+ d = self.__dict__.copy()
+ d['klass'] = c
+ return ("%(klass)s(resolution=%(resolution)s, min=-%(_str_max)s," \
+ + " max=%(_str_max)s, dtype=%(dtype)s)") \
+ % d
+
class iinfo(object):
"""
@@ -280,6 +288,9 @@ max = %(max)s
---------------------------------------------------------------------
''' % {'dtype': self.dtype, 'min': self.min, 'max': self.max}
+ def __repr__(self):
+ return "%s(min=%s, max=%s, dtype=%s)" % (self.__class__.__name__,
+ self.min, self.max, self.dtype)
if __name__ == '__main__':
f = finfo(ntypes.single)