From 8c7b18daed37704cf025562d0ce3a85656cccfe7 Mon Sep 17 00:00:00 2001 From: antonymayi Date: Tue, 10 Nov 2015 14:50:54 +0100 Subject: [PATCH] python 2.6 compatibility tweak replacing set literal {} with set() for python 2.6 compatibility (plus reformatting the line) --- python-package/xgboost/core.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python-package/xgboost/core.py b/python-package/xgboost/core.py index 489c4a9b5..61dec61ef 100644 --- a/python-package/xgboost/core.py +++ b/python-package/xgboost/core.py @@ -538,7 +538,8 @@ class DMatrix(object): msg = 'feature_names must have the same length as data' raise ValueError(msg) # prohibit to use symbols may affect to parse. e.g. []< - if not all(isinstance(f, STRING_TYPES) and not any(x in f for x in {'[', ']', '<'}) + if not all(isinstance(f, STRING_TYPES) and + not any(x in f for x in set(('[', ']', '<'))) for f in feature_names): raise ValueError('feature_names may not contain [, ] or <') else: