Skip to content

Pretty print: sort by string if sorting fails #23586

Closed

Description

@fchapoton

Whenever IPython prints a dict or set, it tries to sort the keys for a nicer output. If the sorting fails, then no sorting is done.

This ticket proposes instead to sort on the string representation if the usual sorting fails. That way, we almost certainly get a deterministic output, which is mainly useful for doctests.

It must be said that sorting rarely fails on Python 2, so this would affect mostly Python 3.

Upstream: ipython/ipython#10767

Upstream: Reported upstream. No feedback yet.

CC: @mkoeppe @dkrenn @koffie

Component: packages: standard

Author: Jeroen Demeyer

Branch/Commit: u/jdemeyer/23586 @ 394d5a4

Reviewer: François Bissey

Issue created by migration from https://trac.sagemath.org/ticket/23586

Activity

  1. added this to the sage-8.1 milestone on Aug 5, 2017
  2. fchapoton commented on Aug 5, 2017

    @fchapoton
    ContributorAuthor
  3. fchapoton commented on Aug 5, 2017

    @fchapoton
    ContributorAuthor

    Commit: 9b314dd

  4. fchapoton commented on Aug 5, 2017

    @fchapoton
    ContributorAuthor

    New commits:

    9b314ddfixing pynormaliz doctests
  5. fchapoton commented on Aug 7, 2017

    @fchapoton
    ContributorAuthor
    comment:2

    bot is morally green

  6. jdemeyer commented on Aug 11, 2017

    @jdemeyer
    Contributor
    comment:4

    Do you have any idea why the output has changed? I usually find it dangerous to just accept doctest changes like this without understanding the reason.

  7. jdemeyer commented on Aug 11, 2017

    @jdemeyer
    Contributor
    comment:5

    Replying to @fchapoton:

    bot is morally green

    Those bots do not have pynormaliz installed, that means nothing...

    On my bots I try to install all optional packages, so sage4 and arando should have it.

  8. kiwifb commented on Aug 11, 2017

    @kiwifb
    Member
    comment:6

    Looks to me like only the ordering of the solutions has changed. The overall set is still the same.

  9. jdemeyer commented on Aug 11, 2017

    @jdemeyer
    Contributor
    comment:7

    Replying to @kiwifb:

    Looks to me like only the ordering of the solutions has changed.

    That still doesn't answer the "why" question.

  10. 37 remaining items

  11. koffie commented on Aug 31, 2017

    @koffie
    Contributor
    comment:34

    Why needs review? I agree with the new description. But we still need to see if IPython accepts our PR and update ipython after it had done so.

  12. koffie commented on Aug 31, 2017

    @koffie
    Contributor

    Upstream: Reported upstream. No feedback yet.

  13. videlec commented on Nov 24, 2017

    @videlec
    Contributor
    comment:35

    Pull request has been merged...

  14. fchapoton commented on Oct 10, 2021

    @fchapoton
    ContributorAuthor
    comment:36

    close as obsolete ?

  15. removed this from the sage-8.1 milestone on Oct 10, 2021
  16. kiwifb commented on Oct 10, 2021

    @kiwifb
    Member

    Reviewer: François Bissey

  17. kiwifb commented on Oct 10, 2021

    @kiwifb
    Member
    comment:37

    Seems like the people involved lost interest 4 years ago so let's obsolete it.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions