On Fri, Oct 19, 2012 at 10:20 AM, Barry Warsaw <barry at python.org> wrote: > On Oct 18, 2012, at 09:23 PM, Daniel Holth wrote: > >>The email module provides an ordered multidict interface to the data. >>The first tag wins (if you improperly define Name: twice for example), >>but the order of everything is preserved. We just don't need it, >>except that it might be surprising to see your classifiers randomly >>re-ordered. > > Just to be clear, the email package preserves both the order and presence of > headers. So if you do add Name: twice, both will be retained. Plenty of > email headers (e.g. Received) can appear multiple times. > > The getitem API will indeed return just the first entry, but there is an > alternative API that you can use to get all of them, in order. Deletions and > re-insertions obviously change the order (the insertion is always an append), > although there is a .replace_header() method for preserving existing order > (kind of - only for the first instance of a header). It's a nice interface. I was surprised that there is no collections.OrderedMultiDict.
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