A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2001-June/015378.html below:

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

[Python-Dev] Adding .decode() method to Unicode [Python-Dev] Adding .decode() method to UnicodeFredrik Lundh fredrik@pythonware.com
Tue, 12 Jun 2001 16:45:16 +0200
barry 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[2].lower() == 'q':
> ...   name = parts[3].decode('quopri')
> ... elif parts[2].lower() == 'b':
> ...   name = parts[3].decode('base64')

uhuh?  and how exactly is this cooler than being able to do
something like the following:

    import quopri, base64
    s = msg['from']
    parts = s.split('?')
    if parts[2].lower() == 'q':
        name = quopri.decodestring(parts[3])
    elif parts[2].lower() == 'b':
        name = base64.decodestring(parts[3])

(going through the codec registry is slower, and imports more
modules, but what's so cool with that?)

</F>




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4