Eric Firing wrote:
> The fix is:
> 
> def is_string_like(obj):
>     """
>     Return True if *obj* looks like a string
> 
>     Such objects should include Python strings, unicode
>     strings, and numpy string array scalars.
>     """
>     #if hasattr(obj, 'shape'): return 0
>     # I think the above is a legacy of Numeric...
>     try:
>         if str(obj) + '' == obj:
>             return True
>     except (TypeError, ValueError):
>         return False
>     return True
> 
> I am not even sure if the above is the fix we want, but having numpy
> string array elements fail "is_string_like" seems like a fundamentally
> bad thing.

I agree.  It's even more egregious when you consider that:

>>>s = numpy.string_('Foo')
>>>isinstance(s, str)
True

I think a nicer workaround at the moment might be to just see if the
passed in object *is* indeed a string instance, and if so, return True.
 I can't imagine that breaking anything.  Figuring out why font
dictionary handling breaks would be good to do however.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to