Skip to content

Check stability of sorted() code #120

Open

Description

@alanjds

As pointed on #82 (comment), the sorting of lists are not respecting stability or comparison of types:

$ python -c 'print sorted([1,1.0,2,2.0], reverse=True)'
[2, 2.0, 1, 1.0]
$ grumpy -c 'print sorted([1,1.0,2,2.0], reverse=True)'
[2.0, 2, 1.0, 1]

The implementation should be checked.

Activity

  1. funny-falcon commented on Oct 29, 2018

    @funny-falcon

    Problem is in current reverse option implementation. It should not be implemented as reversed(sorted(l)), but as negation of comparison function.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions