-
Notifications
You must be signed in to change notification settings - Fork 35
Constructing a FieldArray from a list of ndarray objects fails typechecking #603
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
Comments
I suppose we could add The typing in NumPy, and consequently this package, have been challenging to say the least. See #486. |
That would fix my problem. It also seems like the right thing to do since the initializer already passes the “iterable” off to np.array() here, so in practice the FieldArray constructor already accepts anything that's acceptable by np.array(), at least so long as the values can be converted to field elements. |
Released in v0.4.6. |
Consider the following example:
This runs just fine, but typechecking with pyright fails only for the third assignment:
(The two errors are exactly the same, except one is about
__new__
and the other about__init__
.)So the question is: why is an NDArray considered not IterableLike? An
ndarray
instance is definitely iterable. Is this a bug in the type definitions for galois?For reference: I'm using Python 3.13.3, galois 0.4.5, pyright 1.1.400.
The text was updated successfully, but these errors were encountered: