Skip to content

Commit ce51690

Browse files
authored
1 parent bfa318c commit ce51690

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

IPy.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import bisect
1212
import collections
13-
import sys
1413
import types
1514

1615
# Definition of the Ranges for IPv4 IPs
@@ -121,13 +120,14 @@
121120
IPV6_TEST_MAP = 0xffffffffffffffffffffffff00000000
122121
IPV6_MAP_MASK = 0x00000000000000000000ffff00000000
123122

124-
if sys.version_info >= (3,):
123+
try:
124+
INT_TYPES = (int, long)
125+
STR_TYPES = (str, unicode)
126+
xrange
127+
except NameError:
125128
INT_TYPES = (int,)
126129
STR_TYPES = (str,)
127130
xrange = range
128-
else:
129-
INT_TYPES = (int, long)
130-
STR_TYPES = (str, unicode)
131131

132132

133133
class IPint(object):

0 commit comments

Comments
 (0)