[Python-Dev] reflections on basestring -- and other abstract basetypes

Guido van Rossum guido at python.org
Mon Nov 3 12:43:06 EST 2003

> 1. Shouldn't class UserString.UserString inherit from basestring?
>    After all, basestring exists specifically in order to encourage
>    typetests of the form isinstance(x, basestring) -- wouldn't it be
>    better if such tests could also catch "user-tweaked strings"
>    derived from UserString ... ?

I wish I had time for this thread today, but it doesn't look like it.
I just wish to express that we shouldn't lightly mess with this.   I
added basestr specifically to support some code that was interested in
testing whether something was one of the *builtin* string types (or a
subclass thereof).  But I don't recall details and won't be able to
dig them up today.

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

More information about the Python-Dev mailing list