[Python-Dev] Adding .decode() method to Unicode

Barry A. Warsaw barry@digicool.com
Tue, 12 Jun 2001 10:22:26 -0400

>>>>> "M" == M  <mal@lemburg.com> writes:

    M> Codecs are in no way constrained to only interface between
    M> strings and Unicode. There are many other possibilities for
    M> their usage out there. Just look at the latest checkins for a
    M> bunch of string-string codecs for examples of codecs which
    M> solve common real-life problems and do not interface to
    M> Unicode.

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[2].lower() == 'q':
...   name = parts[3].decode('quopri')
... elif parts[2].lower() == 'b':
...   name = parts[3].decode('base64')