Merge pull request #615 from antonymayi/master

python 2.6 compatibility tweak
This commit is contained in:
Yuan (Terry) Tang 2015-11-10 08:26:12 -06:00
commit f91ce704f3

View File

@ -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: