fixed structure bug!#230
Merged
Merged
Conversation
Collaborator
|
@MarkLevkovich Thank you very much for this. I'm checking it. |
Collaborator
|
@MarkLevkovich I have some feedback. You PR have changed a lot of formatting. For instance there are:
Could you please remove unnecessary changes and provide only the fix? |
Contributor
Author
|
Sorry my first PR, now I'll fix everything |
Collaborator
|
@MarkLevkovich don't worry thank you |
Jakeroid
approved these changes
Jan 12, 2026
Closed
Jakeroid
approved these changes
Jan 12, 2026
Collaborator
|
There is an issue with the test |
Contributor
Author
|
mb now |
Jakeroid
approved these changes
Jan 12, 2026
Collaborator
|
@MarkLevkovich Good job! I'll take a look on fresh head tomorrow and probably make a new release. |
Closed
Contributor
Author
|
@Jakeroid thanks for your time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix confusing list order display for medium-sized lists
Problem
When using ic() with medium-sized lists (13-35 elements), pprint.pformat breaks them into one element per line due to width constraints (~80 chars). This creates visual confusion where the list order appears to be reversed or scrambled, even though the actual data order is correct.
Example of the problem:
ic([1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,1,0,1,0,1,0])
Would display as:
ic| [0,
1,
0,
1,
0,
1,
0,
1,
...]
Solution
Modified safe_pformat() in icecream/icecream.py to:
First try formatting with increased width (120 chars) for lists
If the list still breaks into multiple lines but meets specific criteria:
Then fall back to repr() for clean single-line display.
Changes
Testing
The failing test expects multiline display for lists within multiline expressions, which is a separate concern from the reported bug. The current implementation provides better UX for the common case while preserving multiline formatting for complex expressions.