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

Minor Python 3 compatibility fixes #98

Merged
merged 4 commits into from
Oct 4, 2016
Merged

Minor Python 3 compatibility fixes #98

merged 4 commits into from
Oct 4, 2016

Conversation

carlthome
Copy link
Contributor

@carlthome carlthome commented Sep 26, 2016

Minor compatibility issue with pm.write() fixed.

  • In Python2, range returns a list.
  • In Python3, range returns an iterator.

Thus channels does not have a remove method in a Python 3 environment. This pull request fixes that by explicitly making channels into a list.

@carlthome
Copy link
Contributor Author

carlthome commented Sep 26, 2016

Unfortunately tests fail even on the master branch in both Python 2 and 3 (without any modifications on my part) so it's hard to tell if this minor change will cause any trouble (though I seriously doubt it).

EDIT: Perhaps adding Travis to this repo would be sweet? 🎉

@carlthome
Copy link
Contributor Author

Python 2.7 is the oldest version that has cmp_to_key. I think that should be okay, right?

@carlthome carlthome changed the title Make sure range is actually a list Minor Python 3 compatibility fixes Sep 26, 2016
@craffel
Copy link
Owner

craffel commented Sep 28, 2016

Hey, thanks for this. There are a few other places where a comparison function is being used. Do you want to put cmp_to_key on all of them in this PR?

Python 2.7 is the oldest version that has cmp_to_key. I think that should be okay, right?

Yes, requiring 2.7 is fine.

EDIT: Perhaps adding Travis to this repo would be sweet?

This will happen sometime.

@craffel
Copy link
Owner

craffel commented Oct 4, 2016

@carlthome now that mido is the backend, let's get this merged so that we can claim Python 3 compatibility! Looks like you need to rebase.

@carlthome
Copy link
Contributor Author

Great news, @craffel!

Rebased and merged with current master. 👍

I'm unable to find any other places using cmp though (searching through all .py files didn't pop up anything, what am I missing?)

@craffel
Copy link
Owner

craffel commented Oct 4, 2016

Oops, sorry, I misunderstood - thought the issue was whenever key= was used, not whenever cmp= was used. You found the only usage of cmp=. Merging!

@craffel craffel merged commit d85e0c8 into craffel:master Oct 4, 2016
@carlthome carlthome deleted the patch-3 branch October 4, 2016 23:37
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