[Python-Dev] Re: [Python-checkins] python/dist/src/Lib types.py,1.26,1.27

Guido van Rossum guido@python.org
Wed, 22 May 2002 13:16:59 -0400


>     GvR> I think the plan is to stop recommending the types module --
>     GvR> maybe deprecating it too.

[BAW]
> Why?  Isn't this still a useful idiom:
> 
> from types import *
> ...
> if isinstance(x, StringTypes):
>     # blah
> 
> Yah, I know many of the fundamental types are available as builtins,
> but not all of them.  Or are we saying that we'd now rather see the
> above written as:
> 
> if isinstance(x, (str, unicode)):
>     # blah
> 
> ?

You've got a point there.  (str, unicode) is no good in the standard
library since Python might be compiled without Unicode support.

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