Skip to content

Print every value when arguments are unpacked - #255

Open
x0Lazarus wants to merge 1 commit into
gruns:masterfrom
x0Lazarus:fix/unpacked-argument-output
Open

x0Lazarus wants to merge 1 commit into
gruns:masterfrom
x0Lazarus:fix/unpacked-argument-output

Conversation

@x0Lazarus

Copy link
Copy Markdown

Calls such as ic(*values) currently print only the first value. Mixed calls can also attach the wrong label: with values = [10, 20, 30] and last = 99, ic(*values, last) prints ic| *values: 10, last: 20, dropping both 30 and 99.

This change prints every argument in order and omits expression labels for calls that unpack arguments. The example now prints ic| 10, 20, 30, 99. Once Python has unpacked the arguments, their values cannot reliably be matched to the original expressions; this fallback avoids guessing or evaluating an iterable again. Ordinary calls keep their labels. The README explains the fallback.

Added tests for mixed and empty expansions, multiple expansions, generators, custom formatting, wrapped output, and return values. On Windows with Python 3.12, all 10 new tests and mypy icecream pass. The full suite has 74 passing tests and one existing Windows path-parsing error in test_context_abs_path_multi_line; the unchanged base has the same error.

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

Successfully merging this pull request may close these issues.

1 participant