-
-
Notifications
You must be signed in to change notification settings - Fork 12k
ENH: Add spaces after punctuation in dtype repr/str. #19686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
shubham11941140
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a mistake. If you add a space before the function, it will changes the complete functioning of variable, Remove the spacing.
|
I think the old behavior might need to be preserved behind a |
|
I tried looking into that, but overloading |
|
I think probably just a sequence of comparisons to known versions is probably ok, rather than building a full parser. |
|
OK, added the ability to switch back to the old repr. |
Before:
```
In [1]: np.dtype({"names": ["a"], "formats": [int], "offsets": [2]})
Out[1]: dtype({'names':['a'], 'formats':['<i8'], 'offsets':[2], 'itemsize':10})
```
After:
```
In [1]: np.dtype({"names": ["a"], "formats": [int], "offsets": [2]})
Out[1]: dtype({'names': ['a'], 'formats': ['<i8'], 'offsets': [2], 'itemsize': 10})
```
BvB93
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add support for the new "1.21" legacy-option in the arrayprint.pyi stub file?
All you'd have to do is a bit of copy pasting with the following pattern:
- Optional[Literal[False, "1.13"]]
+ Optional[Literal[False, "1.13", "1.21"]]|
done |
|
Since this is, in some small sense, breaking backward compatibility, perhaps a release note is needed? |
|
added changelog entry. |
|
We discussed this briefly and I think we can move ahead with this. |
|
Thanks @anntzer lets give this a shot! If anyone stumbles on it or has concerns please make a note/open an issue. |
Before:
After:
The version with spaces feels much more idiomatic to me...