From: Jouni K S. <jk...@ik...> - 2006-11-05 19:24:18
|
"Nicolas Grilly" <nic...@ga...> writes: [about is_string_like] > But in this function, I don't like the idea to try an operation on a > string, and wait for an exception in order to know if we really have a > string or not. It's not very efficient, nor very beautiful. I wouldn't worry about efficiency until there is a demonstrable need to speed something up. > I guess initial developer did that to keep compatibility with old > Python versions. I've always thought that is_string_like is there to allow compatibility with _future_ code where someone is using a new kind of string-like object that works just like a string but for which isinstance(x, (str, unicode)) is false. -- Jouni |