fix: EmptyArray.is_numpy should be False. #1971
Merged
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.
EmptyArray.is_numpy
is nowFalse
because it's surprising. (EmptyArrays
are sometimes coerced to beingNumpyArrays
withdtype=np.float64
to match the NumPy behavior, but in general,EmptyArray
represents an unknown type, not a NumPy-like type.)There's already
EmptyArray.is_unknown
to identify them, and everywhere that we actually cared about it, we were already checking for it:The first section really wants only
NumpyArray
because it's checking for arrays ofchar
orbyte
, whichEmptyArray
is not. The last two, inak_transform.py
, are examples in docstrings. Everything else already checks foris_numpy or is_unknown
.Demonstrably, it does not affect any tests.
📚 The documentation for this PR will be available at https://awkward-array.readthedocs.io/en/jpivarski-emptyarray.is_numpy-should-be-false/ once Read the Docs has finished building 🔨