This repository was archived by the owner on Nov 17, 2023. It is now read-only.
[MXNET-696] Define cmp() in Python 3 again#12295
Merged
sandeep-krishnamurthy merged 1 commit intoapache:masterfrom Aug 23, 2018
Merged
[MXNET-696] Define cmp() in Python 3 again#12295sandeep-krishnamurthy merged 1 commit intoapache:masterfrom
sandeep-krishnamurthy merged 1 commit intoapache:masterfrom
Conversation
Contributor
piyushghai
approved these changes
Aug 22, 2018
Contributor
piyushghai
left a comment
There was a problem hiding this comment.
LGTM.
Thanks for fixing the pylint issue here.
lebeg
reviewed
Aug 23, 2018
| import re | ||
| from mxnet.test_utils import assert_almost_equal | ||
|
|
||
| try: |
Contributor
There was a problem hiding this comment.
cmp = lambda(x, y): (x > y) - (x < y) could also work with a bit less code
Contributor
Author
There was a problem hiding this comment.
- It is a Python 3 syntax error
- With the syntax fixed it generates a PEP8 violation in flake8 https://stackoverflow.com/questions/25010167/e731-do-not-assign-a-lambda-expression-use-a-def
sandeep-krishnamurthy
approved these changes
Aug 23, 2018
XinYao1994
pushed a commit
to XinYao1994/incubator-mxnet
that referenced
this pull request
Aug 29, 2018
anirudh2290
pushed a commit
to anirudh2290/mxnet
that referenced
this pull request
Sep 19, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A second attempt at #12191 with no Unicode characters this time...
Fixes #8270 @vandanavk
cmp() was removed in Python 3 so this PR recreates it if required leveraging the formula at http://python-future.org/compatible_idioms.html#cmp
Description
Define cmp() in Python 3
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
Comments
@marcoabreu #12237 (comment)