| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
I'm a sphinx noob, so I had Claude write the release note. Content-wise it looks fine to me, but there might be sphinx issues or something 🤷🏻. |
Sorry, something went wrong.
|
Sorry, something went wrong.
|
Diff from mypy_primer, showing the effect of this PR on type check results on a corpus of open source code: pandas (https://github.com/pandas-dev/pandas)
+ pandas/_typing.py:91: error: Unused "type: ignore" comment [unused-ignore]
|
Sorry, something went wrong.
|
Do you consider this ready? I note several runs of mypy_primer. |
Sorry, something went wrong.
Ah yea sorry about that, I was tweaking "vibe coding" the release notes for a bit before. But it should be ready for review. |
Sorry, something went wrong.
|
Thanks Joren, let's see how it goes. The vibe coding is an interesting experiment. Is there anyway to control the line length? |
Sorry, something went wrong.
Hmmm, I guess you could try including it in the prompt 🤷🏻? |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
numpy.typing.NBitBase is intended to be used as e.g.
This will lead to problems for float64 and complex128, which were changed into concrete subtypes of floating and complexfloating in NumPy 2.2. That means that e.g. floating[_64Bit] is no longer assignable to float64, causing type-checkers to reject x: float64 = f(complex128(1)). This defeats its purpose, and should therefore no longer be used.
The general alternative is to use typing.overload:
And even though it has gotten more verbose, it requires less mental to interpret.
In situations where the input scalar type is the same as the output type, there's a simpler alternative:
Old:
New:
This also makes the code more readable, IMO.
Note that at the moment, float32 is assignable to floating[_32Bit], because it is defined as a type alias, as opposed to a proper subtype. In NumType this has already been fixed (i.e. it's incorrect) for all scalar types.