Skip to content

Commit 9b5735e

Browse files
committed
fix map and filter check on python 2 and 3.
1 parent df0c7e9 commit 9b5735e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

objectpath/core/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from types import GeneratorType as generator
88
from itertools import chain
9+
from sys import version_info
910

1011
SELECTOR_OPS = [
1112
"is", ">", "<", "is not", ">=", "<=", "in", "not in", ":", "and", "or", "matches", "fn"
@@ -27,10 +28,8 @@
2728

2829
ITER_TYPES = [list, generator, chain]
2930

30-
try:
31+
if version_info.major == 3:
3132
ITER_TYPES += [map, filter]
32-
except NameError:
33-
pass
3433

3534
class ProgrammingError(Exception):
3635
pass

0 commit comments

Comments
 (0)