Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 compatibility #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Python 3 compatibility #34

wants to merge 2 commits into from

Conversation

germangh
Copy link

Just ran 2to3 on the codebase so this version should be compabible with
both Python 2 and 3.

German Gomez-Herrero added 2 commits July 15, 2015 14:31
Just ran 2to3 on the codebase so this version should be compabible with
both Python 2 and 3.
@@ -191,7 +191,7 @@ def get_params_tuples(self):
"""
tuple_list = []
if len(self.params) > 0:
for param in self.params.keys():
for param in list(self.params.keys()):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this simply: for param in self.params: in both Python 2 and 3? Getting a list of keys for a dictionary isn't necessary in Python. For repeatability, think about using for param in sorted(self.params):

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are right, there is not need of the list() to run this in Python 3. Just run the automatic 2to3 converter so I'm not sure why the converter thought you can't just iterate over the keys without creating a list.

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.

2 participants