What's the cleanest way to compare 2 dictionary?
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Fri Aug 11 13:51:01 EDT 2006
In <1155318148.342951.12590 at h48g2000cwc.googlegroups.com>, John Henry
wrote:
> When I do it under 2.3, I get:
>
> common_eq = set(k for k in _common if a[k] == b[k])
> ^
> SyntaxError: invalid syntax
>
> Don't know why that is.
There are no generator expressions in 2.3. Turn it into a list
comprehension::
common_eq = set([k for k in _common if a[k] == b[k]])
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list