[Python-Dev] Adding .decode() method to Unicode
Tue, 12 Jun 2001 10:22:31 -0700
"Barry A. Warsaw" wrote:
> Having just followed this thread tangentially, I do have to say it
> seems quite cool to be able to do something like the following in
> Python 2.2:
> >>> s = msg['from']
> >>> parts = s.split('?')
> >>> if parts.lower() == 'q':
> ... name = parts.decode('quopri')
> ... elif parts.lower() == 'b':
> ... name = parts.decode('base64')
I think that the central point is that if code like the above is useful
and supported then it needs to be the same for Unicode strings as for
8-bit strings. If the code above is NOT useful and should NOT be
supported then we need to undo it before 2.2 ships. This unicode.decode
argument is just a proxy for the real argument about the above.
I don't feel strongly one way or another about this (ab?)use of the
codecs concept, myself, but I do feel strongly that Unicode strings
should behave as much as possible like 8-bit strings.
Take a recipe. Leave a recipe.
Python Cookbook! http://www.ActiveState.com/pythoncookbook