On Mon, Jul 21, 2008 at 7:51 AM, David Kaplan <[EMAIL PROTECTED]> wrote:

> 2) Can someone explain to me why is_string_like in the cbook doesn't
> just do isinstance(obj,str)?  Is there anything "string like" that won't
> be caught be this isinstance call?

  In [65]: s = u'jdh'

  In [66]: isinstance(s, str)
  Out[66]: False

  In [67]: isinstance(s, unicode)
  Out[67]: True

So we could check for str or unicode, but a user may be using a custom
string like class from some c++ extension code that is part of a large
in house API.  The point is that we don't care if it *is* a string, we
just want it to act like a string

  http://en.wikipedia.org/wiki/Duck_typing

-------------------------------------------------------------------------
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