[Python-Dev] Iterable String Redux (aka String ABC)

Guido van Rossum guido at python.org
Mon Jun 2 00:43:38 CEST 2008


On Sun, Jun 1, 2008 at 3:54 AM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> The use case that was cited was recognising subclasses of
> UserString, and that's what I was responding to. If
> basestring were made subclassable and UserString inherited
> from it, that use case would be covered.

UserString intentionally doesn't subclass basestring. When basestring
was introduced, it was specifically meant to be the base class of
*only* str and unicode. There are quite a few core APIs that accept no
substitutes, and being an instance of basestring was intended to
guarantee that a value is accepted by such APIs.

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


More information about the Python-Dev mailing list