You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add an option to reveal_type() to format the type in the same way as error messages. Something like reveal_type(variable, format="short") or similar API.
test.py:7: note: Revealed type is "numpy.ndarray[builtins.tuple[builtins.int, ...], numpy.dtype[numpy.floating[Any]]]"
test.py:8: error: Incompatible return value type (got "ndarray[tuple[int, ...], dtype[floating[Any]]]", expected "ndarray[tuple[int, ...], dtype[float64]]") [return-value]
The error is a numpy bug, and not the point of this request. My point is that the type formatting in reveal_type() is different than in the error message, which makes debugging harder. Compare
I would like to be able to get reveal_type() to display the type in the same way. Form a quick look, it seems that the error message uses format_type_distinctly() whereas reveal_type() uses the str representation. I assume the this is done intentionally and we don't want to change this by default (if that's not the case, could we just change it?). Therefore. I propose to make this configurable through an optional parameter.
The text was updated successfully, but these errors were encountered:
Feature
Add an option to
reveal_type()
to format the type in the same way as error messages. Something likereveal_type(variable, format="short")
or similar API.Pitch
Example (based on a bug in numpy 2.2):
results in
The error is a numpy bug, and not the point of this request. My point is that the type formatting in
reveal_type()
is different than in the error message, which makes debugging harder. CompareI would like to be able to get
reveal_type()
to display the type in the same way. Form a quick look, it seems that the error message usesformat_type_distinctly()
whereasreveal_type()
uses the str representation. I assume the this is done intentionally and we don't want to change this by default (if that's not the case, could we just change it?). Therefore. I propose to make this configurable through an optional parameter.The text was updated successfully, but these errors were encountered: