[Chicago] Question about accessing dictionary's elements.

Lewit, Douglas d-lewit at neiu.edu
Sun Sep 20 04:48:50 CEST 2015


Thanks Skip.  That would work!  I love dictionaries, hash tables, etc.
They are so flexible and useful.

On Sat, Sep 19, 2015 at 2:52 PM, Skip Montanaro <skip.montanaro at gmail.com>
wrote:

> If performance is an issue, why not make the dictionary hierarchical? Key
> the outer dictionary by the first element of the tuple, then have it's
> value be a second dictionary keyed by the second element. Accessing all
> values matching (1, *) would just be d[1].values(). Instead of d[(1,2)] you
> would use d[1][2].
>
> Skip
>
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> https://mail.python.org/mailman/listinfo/chicago
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20150919/bfba0ddb/attachment.html>


More information about the Chicago mailing list