What's the cleanest way to compare 2 dictionary?

John Henry john106henry at hotmail.com
Fri Aug 11 13:42:28 EDT 2006


John Machin wrote:
> John Henry wrote:
> > John,
> >
> > Yes, there are several scenerios.
> >
> > a) Comparing keys only.
> >
> > That's been answered (although I haven't gotten it to work under 2.3
> > yet)
>
> (1) What's the problem with getting it to work under 2.3?
> (2) Why not upgrade?
>

Let me comment on this part first, I am still chewing other parts of
your message.

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.

I can't  upgrade yet.  Some part of my code doesn't compile under 2.4
and I haven't got a chance to investigate further.




More information about the Python-list mailing list