Zip Question

Victor Subervi victorsubervi at gmail.com
Sat Oct 10 10:54:06 EDT 2009


Ah! Thanks :)
V

On Fri, Oct 9, 2009 at 1:10 PM, Stephen Hansen <apt.shansen at gmail.com>wrote:

>
>
> On Fri, Oct 9, 2009 at 11:04 AM, Victor Subervi <victorsubervi at gmail.com>wrote:
>
>> So, because the results in sstp were duplicates ( ['prescriptions',
>> 'prescriptions'] ) it only returned one result in the dict(zip()) statement.
>> Weird. Bug or feature? ;)
>> Thanks,
>> V
>
>
> Feature.
>
> zip() returned two results, but dictionaries are mappings of keys to
> values. If you duplicate a key, you don't get multiple values for that key
> -- you replace the value.  If you want something dictionary like which has
> multiple values, try something like:
>
> http://code.activestate.com/recipes/52219/
>
> Or even this dict subclass:
>
> http://code.activestate.com/recipes/440502/
>
> HTH,
>
> --S
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091010/ef9675fd/attachment-0001.html>


More information about the Python-list mailing list