Propose change in _multivalued objects

Javier Palacios javiplx at gmail.com
Fri Apr 2 09:40:20 UTC 2010


Hello,

In the current form, the multivalued fields are returned like a list. Search
within them is much easier if they are dictionary alike objects.

My use case is the Release file and the checksums multivalued fields. To
search for the md5 of a file I must run over release['MD5Sum'] checking
every name field in its dictionary elements, instead of just use
release['MD5Sum'][name].

So, I use deb822.py patched to return this multivalued dictionaries.
Although I send it attached, I'm not proposing it to inclusion as is, but
only to show, because it will probably break most of the existing code
(requires a '.values()' to return the old list). Mi proposal is to add a
_multivalued_dict class with this behaviour, so allowing a non hardcoded
value for the dictionary key. Using an optional argument on instantiation
indicating the name of the dictionary key might be a better approach,
although I'm not able to see how to implement with the current __init__
prototype.

Javier Palacios
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-python-debian-discuss/attachments/20100402/56ef05d3/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-If-a-name-is-present-produce-dictionaries-instead-o.patch
Type: text/x-patch
Size: 1452 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-python-debian-discuss/attachments/20100402/56ef05d3/attachment.bin>


More information about the pkg-python-debian-discuss mailing list