blob: 6c71489497b6ba3bc96f2c2c01cdecc48d9a4c12 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#
# code to simplify supporting older python versions
#
import sys
from decimal import Decimal
if sys.version_info[:2] < (2, 7):
# Pre-2.7 decimal and float did not compare correctly
def numeric_greater(a, b):
if isinstance(a, Decimal) and isinstance(b, float):
return float(a) > b
elif isinstance(a, float) and isinstance(b, Decimal):
return a > float(b)
else:
return a > b
else:
def numeric_greater(a, b):
return a > b
|