Skip to content

Implement the 'reverse' option for sorted() #82

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

Closed
alanjds opened this issue Oct 6, 2018 · 4 comments
Closed

Implement the 'reverse' option for sorted() #82

alanjds opened this issue Oct 6, 2018 · 4 comments
Labels
imported PR Pull Request imported from google/grumpy waiting feedback Waiting confirmation of changes or fixes

Comments

@alanjds
Copy link

alanjds commented Oct 6, 2018

google#162 opened on Jan 18, 2017 by @MirkoDziadzka

Add the 'reverse' option to 'sorted()'

I'm not sure if this violates the 'stable sort definition in Python.
On the other hand, this is probably only relevant when key or cmp gets implemented.

@alanjds
Copy link
Author

alanjds commented Oct 6, 2018

Comment by trotterdylan
Friday Jan 20, 2017 at 16:17 GMT


That all sounds good. Let me know when I should review again.

@alanjds alanjds added the imported PR Pull Request imported from google/grumpy label Oct 6, 2018
@alanjds alanjds added the waiting feedback Waiting confirmation of changes or fixes label Oct 6, 2018
@funny-falcon
Copy link

While #102 is merged, it is not proper implementation, even without implementation of key or cmp:

$ python -c 'print sorted([1,1.0,2,2.0], reverse=True)'
[2, 2.0, 1, 1.0]
$ grumpy-runtime-src/build/bin/grumprun -c 'print sorted([1,1.0,2,2.0], reverse=True)'
[2.0, 2, 1.0, 1]

It will certainly affect types which implements comparison methods.

@alanjds
Copy link
Author

alanjds commented Oct 29, 2018

:/
It may be about stability too. The sort code should be checked.

@alanjds alanjds changed the title Implement the 'reverse' option for sorted() Wrong order of sorted([1,1.0,2,2.0], reverse=True). Comparison or Stability? Oct 29, 2018
@alanjds alanjds changed the title Wrong order of sorted([1,1.0,2,2.0], reverse=True). Comparison or Stability? Wrong order of sorted([1,1.0,2,2.0], reverse=True) results Oct 29, 2018
@alanjds alanjds changed the title Wrong order of sorted([1,1.0,2,2.0], reverse=True) results Implement the 'reverse' option for sorted() Oct 29, 2018
@alanjds alanjds closed this as completed Oct 29, 2018
@alanjds
Copy link
Author

alanjds commented Oct 29, 2018

Closing in favor of #120

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imported PR Pull Request imported from google/grumpy waiting feedback Waiting confirmation of changes or fixes
Projects
None yet
Development

No branches or pull requests

2 participants