Revised PEP 349: Allow str() to return unicode strings

Nick Craig-Wood nick at craig-wood.com
Tue Aug 23 08:29:50 EDT 2005


Thomas Heller <theller at python.net> wrote:
>  I like the fact that currently unicode(x) is guarateed to return a
>  unicode instance, or raises a UnicodeDecodeError.  Same for str(x),
>  which is guaranteed to return a (byte) string instance or raise an
>  error.

I guess its analogous to this...

  >>> int(100000000000000L)
  100000000000000L

>  Wouldn't also a new function make the intent clearer?
> 
>  So I think I'm +1 on the text() built-in, and -0 on changing str.

Couldn't basestring() perform this function?  Its kind of what
basestring is for isn't it?

-- 
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick



More information about the Python-list mailing list