Add round-trip casts between string and (u)int dtypes #72
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.
Making a PR to solicit feedback before I do this again for the float dtypes.
I could have done this without using the python C API but this approach seemed less finicky than dealing with serializing ints as strings in a portable way in C. FWIW, numpy currently does the equivalent cast for the unicode dtype by going through numpy scalars. In principle in the future we could drop the GIL requirement and do this in a more low-level way.
There's a lot of copy/paste here. It's very possible we've reached or are long past the point where writing this in C++ would be a good idea. I guess if this code is going to end up living in numpy eventually it's not problematic to add a build dependency on a C++ toolchain.