feat(expr-ir): Improve lit repr#3641
Merged
Merged
Conversation
- Child of #2572 - Been bugging me for a while now - Gets *closer* to what `pl.lit` has - But always displays `lit(...)` - And displays `dtype` when ambiguous
``` Name Stmts Miss Branch BrPart Cover Missing ------------------------------------------------------------------------------------ narwhals\_plan\expressions\boolean.py 41 0 4 1 98% 45->46 narwhals\_plan\expressions\temporal.py 65 0 4 1 99% 81->82 ```
dangotbanned
commented
May 18, 2026
Comment on lines
+45
to
+46
| class AllHorizontal(_HorizontalBoolean): ... | ||
| class AnyHorizontal(_HorizontalBoolean): ... |
Member
Author
There was a problem hiding this comment.
Somehow this was causing coverage to think these lines were uncovered? 😂
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.
Description
Brief interlude before getting back to (#3497)
Note
Just trying to keep myself sane with something unimportant 😅
Before
Writing the docs (and doc tests) has made me very unhappy with whatever this was.
narwhals/narwhals/_plan/expressions/literal.py
Line 47 in 10857f9
narwhals/narwhals/_plan/when_then.py
Line 116 in 10857f9
After
A little less noisy
narwhals/narwhals/_plan/expressions/literal.py
Line 47 in df41a44
narwhals/narwhals/_plan/when_then.py
Line 116 in df41a44
Those were smallest examples I could find.
These are the exhaustive tests
Hah, made you look 😉
narwhals/tests/plan/repr_test.py
Lines 82 to 263 in df41a44
What's changed?
pl.lit(...)does"im a string"StringEnum,Categorical,Decimal,TemporalNumeric(excludingInt64,Float64)Boolean,StringorBinaryNone, but there is an explicit dtypeRelated issues
ExprIR #2572