~osomon/pyexiv2/pyexiv2-0.3

« back to all changes in this revision

Viewing changes to src/pyexiv2/utils.py

  • Committer: Olivier Tilloy
  • Date: 2010-12-26 18:30:33 UTC
  • mto: This revision was merged to the branch mainline in revision 348.
  • Revision ID: olivier@tilloy.net-20101226183033-m0xvuldnq6bq8jk3
Handle fractions in a transparent manner,
using the convenience functions defined in module pyexiv2.utils.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
import datetime
32
32
import re
33
33
 
34
 
# Support for fractions.Fraction as a replacement for the Rational class is not
35
 
# implemented yet as we have to support versions of Python < 2.6
36
 
# (see https://launchpad.net/bugs/514415).
37
 
# However, it doesn’t hurt to accept Fraction objects as values when the module
38
 
# is available (see https://launchpad.net/bugs/683232).
 
34
# pyexiv2 uses fractions.Fraction when available (Python ≥ 2.6), or falls back
 
35
# on the custom Rational class. This should be transparent to the application
 
36
# developer as both classes have a similar API.
 
37
# This module contains convenience functions to ease manipulation of fractions.
39
38
try:
40
39
    from fractions import Fraction
41
40
except ImportError: