On 2014-02-25 22:54, Peter Otten wrote: > Tim Chase wrote: > > If dicts were to support set ops, > > They do in 2.7 and 3.x. > > >>> a.viewkeys() - b.viewkeys() > set(['a']) > >>> a.viewkeys() & b.viewkeys() > set(['b']) > >>> a.viewkeys() ^ b.viewkeys() > set(['a', 'c']) > >>> a.viewkeys() | b.viewkeys() > set(['a', 'c', 'b']) > > For 3.x replace viewkeys() with keys().
I missed this getting added in the 2.7 release. Thanks for the introduction to .viewkeys()/.keys() as they could prove quite handy. -tkc -- https://mail.python.org/mailman/listinfo/python-list