Customise nps.from_dtype()
with keyword argument passthrough
#2619
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When this can also be hooked up to
arrays(..., elements=kwargs)
, it's almost surprising that it took us so long to think of - it's reasonably easy to implement, conceptually obvious, and very useful to generate arrays of all-finite or bounded elements without falling afoul of our precision-loss and overflow checks.@rsokl: note that I moved our existing tests for
from_dtype()
to a new test module, astest_gen_data
was getting way too large. You should therefore probably review the two commits separately.The extension for
complex_numbers()
would be almost trivial, except that the strategy doesn't currently accept awidth
argument and I would prefer not to add that into the same change as everything else here. Happy to add that on request from someone who would actually use it though!Closes #2552.