How do I distinguish a string from a sequence?
Paul Moore
gustav at morpheus.demon.co.uk
Fri Sep 28 15:45:50 EDT 2001
On 28 Sep 2001 16:03:24 +0200, Janko Hauser <jhauser at ifm.uni-kiel.de> wrote:
>In your application it would be best to test for some method of
>strings you need in your processing. In this way you are guaranteeing
>that your object has the right interface, regardless of type.
Regrettably, I don't think there is one. "Ability to be passed to popen2()" is
what I'm after (at least in the initial version, later I might use fork/exec or
low-level Win32 calls) and that isn't testable for...
I could pick an arbitrary string method, I guess. But that feels no better than
type testing, and even more of a hack.
Maybe there should be a common abstract base class for strings and Unicode
strings, in the 2.2 class/type unification stuff?
Paul.
More information about the Python-list
mailing list