[Python-Dev] Comparison speed

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Wed, 16 May 2001 09:28:45 +0200


> Sounds like we ought to do a search-and-destroy on type comparisons,
> replacing with isinstance() where possible.

At least in my applications, this is unfortunately not possible: I
want a test for byte-string-or-unicode-string. This could be done with
two isinstance calls, but that is certainly less efficient.

Marc-Andre once proposed a type representing the immediate supertype
of both byte strings and unicode strings; let's call it abstract string.
Then I could write isinstance(e, types.AbstractString).

Regards,
Martin