Dictionary Views -- good examples? [was Re: Python 3 dict question]
Ethan Furman
ethan at stoneleaf.us
Tue May 10 13:18:53 EDT 2011
Ian Kelly wrote:
> On Fri, May 6, 2011 at 4:49 PM, Ethan Furman wrote:
>> Anybody care to chime in with their usage of this construct?
>
> You should start with PEP 3106. The main idea is that dict.keys() and
> dict.items() can be treated as frozensets, while still being more
> lightweight than lists. That lets you do nifty things like "a.keys()
> == b.keys()" which, if a and b are Python 3 dicts, will tell you
> whether they contain the same keys.
Cool, thanks.
~Ethan~
More information about the Python-list
mailing list