[Tutor] Dictionary of dictionaries issue

Kent Johnson kent37 at tds.net
Thu Nov 13 16:26:38 CET 2008

On Thu, Nov 13, 2008 at 10:01 AM, A.T.Hofkamp <a.t.hofkamp at tue.nl> wrote:
>>>> d3 = dict(( (rv, dict.fromkeys(c)) for rv in r ))

You don't need the double parentheses, this works just as well:
d3 = dict( (rv, dict.fromkeys(c)) for rv in r )

A generator expression just has to be in parentheses, it's OK if the
parens also have other meaning syntactically; in this case indicating
a function call.


More information about the Tutor mailing list