MAINT: treat str special in _array_converter and use it in strings.py - #32297
Draft
mhvk wants to merge 1 commit into
Draft
MAINT: treat str special in _array_converter and use it in strings.py#32297mhvk wants to merge 1 commit into
mhvk wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a follow-up to #32040 (comment), where I suggested that once we start treating
strproperly as a scalar forStringDType, we might be able to do some of the handling of it using_array_converter. It needs a small change to_array_converter(hence ping @seberg), but with it the code instrings.pydoes become somewhat simpler (especially for theTcase).Note that in principle it would be nice to have
np.result_type(array, "string")work, just as is the case fornp.result_type(array, 1.0). However, strings are already greedily interpreted as dtypes, so that doesn't work (goes to show that "conveniences" are not always a good idea). But_array_converterdoes not have that problem.Opening as draft for now, since I'm not 100% sure this is the best approach (esp. for
_array_converter, but also just in ensuring consistency between different numpy parts).No AI.