A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-October/129251.html below:

[Python-Dev] PEP 455: TransformDict

[Python-Dev] PEP 455: TransformDictR. David Murray rdmurray at bitdance.com
Tue Oct 8 21:19:48 CEST 2013
On Tue, 08 Oct 2013 22:02:43 +0400, Yuriy Taraday <yorik.sar at gmail.com> wrote:
> There should be a way to avoid creation of the second dict when there is no
> need to store original keys. For example, email.message module doesn't
> store original headers as they are not needed. The same applies to web
> frameworks parsing HTTP headers or WSGI environment.

This is not true.  email.message *very carefully* preserves the original
header name, case and all [*], that's part of its mandate (faithfully
reproducing the original parsed message).

That said, email.message can't use transformdict, since email.message
needs a list-with-case-insensitive-keyed-lookup, not a dict, because it
also preserves the original *order* of the headers.  And it couldn't use
an orderedtransformdict, either, since it also has to preserve
*duplicate* headers.

--David

[*] currently it loses whitespace information in certain cases, but the
new header parser/folder is supposed to fix that...or will once I fix a
few more corner cases :)
More information about the Python-Dev mailing list

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