-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed as not planned
Closed as not planned
Copy link
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement
Description
Bug report
Bug description:
After numpy 2.0, repr changed for all numpy types (e.g; np.int64 and np.float64).
This had an impact on tuple.str, because it seems that tuple.str refers to item.repr instead of str.
Here, I use Python 3.12.8 and numpy 2.2.0
We now have this behavior:
>>> import numpy as np
>>> x = np.int64(45)
>>> print((x,x))
(np.int64(45), np.int64(45))
>>> print(x)
45
If you use python 3.11.11 and numpy 1.26.0, you had:
>>> import numpy as np
>>> x = np.int64(45)
>>> print((x,x))
(45, 45)
>>> print(x)
45
I personally think that the type has no place in a str conversion, but that's my opinion. Thus, I'm not sure it's a bug or a feature. But I would tend to think that tuple.str should call str and tuple.repr should call repr
CPython versions tested on:
3.11, 3.12
Operating systems tested on:
Linux
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement