gh-149189: Modern defaults for pprint#149190
Conversation
Documentation build overview
9 files changed ·
|
89842d3 to
3f04477
Compare
sobolevn
left a comment
There was a problem hiding this comment.
I fully support this feature! I never used pprint, because I always thought that it is not actually pretty. Multilple nesting levels were really hard to read, indentation was hard to follow.
The only downside that, I think, we should empathise in the "What's new" is that this can break doctests. Let's maybe add a section on how one can restore the old behavior for all versions of Python?
|
It would only break doctests if you're using |
There was a problem hiding this comment.
I do love this new format and agree that people will be happy with it. While this could break tests, I don't think we would have to worry much about that but I am concerned about the fact that explicit compact=True usages will now raise ValueError. For doctests, it's ok, but if someone is using pprint.pprint to render something to the user in an application, that application will no more be running. Sure, it's acceptable because we are using doing this in a new Python version, but legacy CLis that are no more maintained may break =/
| [ [ 'spam', 'eggs', 'lumberjack', | ||
| 'knights', 'ni'], | ||
| 'spam', 'eggs', 'lumberjack', | ||
| 'knights', 'ni'] |
There was a problem hiding this comment.
For this one, I would suggest passing indent=1 and remove indent=4 in the previous test.
| .. versionchanged:: next | ||
| Changed default *indent* from 1 to 4, | ||
| default *width* from 80 to 88, | ||
| and default *expand* from ``False`` to ``True``. |
There was a problem hiding this comment.
The default for expand does not need to be documented. Otherwise we have duplicate 3.15 entries.
| compact=False, | ||
| expand=True, |
There was a problem hiding this comment.
Won't this break anyone using compact=True explicitl?
Good point. How about we remove the |
What about an explicit I don't have a solution for this problem though. Making |
|
I've removed the |
|
I thought about it yesterday offline and I either don't remember or don't undertand why we added Pre-3.15, we have The way I see it: In my ideal world, I would have some If we want to retain those two parameters together, I think what you did is the best. But please document that passing |
We added it to basically make the output nicer.
I guess it was an addition because that's the incremental step and didn't want to change the default. But now we are! So perhaps we should remove
Hmm, I'm not so keen on
Added the note for now. |
Honestly, I would say yes. If, in the future, we want to have fine-grained control, we should add a unique The only thing we would break is:
Here, I'm playing the devil's advocate but I wanted to highilght those observations for the future us. My personal take is: remove Another reason why I would just change the meaning of
|
Given:
mainproduces:This PR produces:
pprint#149189