-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Deprecate is_string_like #7835
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Why is 'isinstance' checking better than improving the duck typing? |
Because I doubt you will ever be able to make it possible to pass 0d-masked-arrays to |
Isn't the purpose of having a |
|
Do we really have no uses of |
There may well be some -- but my guess is (and a quick grep suggests) that they are a minority, so I'd suggest looking at them and asking whether we really need to support them (note that as mentioned above, so far numpy 0d arrays of string dtype were actually rejected, only 0d masked arrays of string dtype were accepted, and no one seemed to complain.) I did just realize that indexing numpy string arrays returns a |
Closed by #8011. |
deprecation warnings for matplotlib>=2.1.0) similar to - matplotlib/matplotlib#8535 - matplotlib/matplotlib#7835
With version 2.1 the function 'is_string_like' was deprecated, with version 3.0.0 it was removed entirely. * matplotlib/matplotlib#7835 * https://matplotlib.org/3.0.0/api/api_changes.html
This issue is similar to #7795 ("is_numlike should be deprecated and replaced by the correct isinstance calls"):
cbook.is_string_like
returns True for 0-dimensional masked arrays of string dtype (but not regular arrays...), but testing foris_string_like
is often followed by calling of string methods (.lower()
, etc.) on the object, or passing the object to, say,open()
-- neither of which work with masked arrays of string dtype. (check yourself withgit grep -A2 'is_string_like('
)In other words the actual semantics of the function simply do not match how it is used.
Most of these calls should probably be replaced by
isinstance(obj, six.string_types)
(possiblyisinstance(obj, (six.string_types, six.binary_type))
depending on the case), which is much more explicit.The text was updated successfully, but these errors were encountered: