aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pyexiv2/utils.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/pyexiv2/utils.py b/src/pyexiv2/utils.py
index 22a05f7..b22bada 100644
--- a/src/pyexiv2/utils.py
+++ b/src/pyexiv2/utils.py
@@ -269,6 +269,17 @@ class Rational(object):
"""
return '%d/%d' % (self._numerator, self._denominator)
+ def __repr__(self):
+ """
+ Representation used when object is ouput to string for debug or array
+ content display, e.g. print([Rational(1,2),Rational(3,4)]).
+
+ :return: string representation of the object (class instance) for debugging
+ :rtype: string
+ """
+ return '%s(%d,%d)' % (self.__class__.__name__,self._numerator,self._denominator)
+
+
def is_fraction(obj):
"""