[Python-Dev] Need a way to test for 8-bit-or-unicode-string

Guido van Rossum guido@python.org
Fri, 05 Oct 2001 13:07:32 -0400


> Yes, I'm sure: we need a PEP first.  Ideally it would answer some of
> the questions raised above, and it would lay out the class hierarchy.

The more I think about this, the more I agree that we need a PEP
first: there are lots of potential traps.  Maybe the biggest danger:
declaring an abstract base class for e.g. "sequence-ness" would
encourage programmers to test isinstance(x, sequencebase) when all
they *really* need is something that supports the __getitem__
protocol.  This would encourage writing code that is less polymorphic
than it could be, and that would be a real loss.

--Guido van Rossum (home page: http://www.python.org/~guido/)