Skip to content

Conversation

@truebit
Copy link
Contributor

@truebit truebit commented Oct 21, 2019

NameError for map and fitler would only occur in python 1.
Python 2 and 3 both got these two keywords.

And type(map(string.lower, 'ABC')) is map is not true in Python 2, but true in Python 3.
So I got a version check to add map and filter.

@coveralls
Copy link

coveralls commented Oct 21, 2019

Coverage Status

Coverage increased (+0.1%) to 89.214% when pulling 4f13d3f on truebit:master into f240821 on adriank:master.

@adriank
Copy link
Owner

adriank commented Oct 21, 2019

Thanks for the PR.

What problem does it solve? From what I remember, try..catch was a little bit faster and made the code work on Python 2 and 3, while other solutions didn't. I wonder if after change this would still work on PyPy or Python 3.3 for example.

@truebit
Copy link
Contributor Author

truebit commented Oct 22, 2019

This PR fixes #91 tests failure on python 2.

As I mentioned, map and filter cannot be differed by try...catch, as they both exist in python 2 and 3.
sys.version_info was introduced in python2.0. I changed access of named tuple attributes to list index to make it working in >=python2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants