From 4f13d3fba79d46cfdac5974a6eed71712a4a7ac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=AA=E5=95=B8?= Date: Tue, 22 Oct 2019 15:34:52 +0800 Subject: [PATCH] fix map and filter check on python 2 and 3 --- objectpath/core/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/objectpath/core/__init__.py b/objectpath/core/__init__.py index 87be863..9ce75de 100644 --- a/objectpath/core/__init__.py +++ b/objectpath/core/__init__.py @@ -6,6 +6,7 @@ from types import GeneratorType as generator from itertools import chain +from sys import version_info SELECTOR_OPS = [ "is", ">", "<", "is not", ">=", "<=", "in", "not in", ":", "and", "or", "matches", "fn" @@ -27,10 +28,8 @@ ITER_TYPES = [list, generator, chain] -try: +if version_info[0] >= 3: ITER_TYPES += [map, filter] -except NameError: - pass class ProgrammingError(Exception): pass