- Notifications
You must be signed in to change notification settings - Fork15
Improve construction when inferring sub-array dtype (a.k.a. array subdtype)#381
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
coveralls commentedFeb 3, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
| # If we know the dtype, then using `np.fromiter` is much faster | ||
| dtype=lookup_dtype(dtype) | ||
| values=np.fromiter(iter_values,dtype.np_type) | ||
| ifdtype.np_type.subdtypeisnotNoneandnp.__version__[:5]in {"1.21.","1.22."}: |
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.
I think this is the first time we actually use the version of a dependency. This way is pretty low-tech, and hopefully fine. If we need to do more version-dependent behavior, we'll probably want to use a helper utility such aspackaging.version.parse.
Also, CI testing of dependency versions FTW!
We can drop 1.21 in June, and 1.22 next January.
eriknw commentedFeb 4, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I need this for another PR (#382), merging. |
This gives us an easy, consistent way to infer sub-array dtypes upon when constructing objects. Also, this handles more cases (I apparently missed some!). See tests for examples.