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

Formatting of dict keys depends on the length of the corresponding value #78

Open
anntzer opened this issue Aug 21, 2020 · 0 comments
Open

Comments

@anntzer
Copy link
Contributor

anntzer commented Aug 21, 2020

  • PrettyPrinter version: 0.17
  • Python version: 38
  • Operating System: linux

Description

As in the title.

What I Did

from prettyprinter import pprint
pprint({
    (1, 2, 3):
        "short string",
    (4, 5, 6):
        "a really long string, if you see what I mean, just padding it for "
        "the sake of it",
})

outputs

{
    (1, 2, 3): 'short string',
    (
        4,
        5,
        6
    ):
        'a really long string, if you see what I mean, just padding it for '
        'the sake of it'
}

I would argue that a single-line-printable key should not be forced use to multiline output even if the value needs multiline output (in other words, the layout in the source seems more legible to me).

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

No branches or pull requests

1 participant