[Tutor] Dictionary of dictionaries issue

Pablo Englebienne pablo.englebienne at gmail.com
Thu Nov 13 20:30:14 CET 2008


Thank you all, this is exactly what I was trying to do and the syntax is 
beautiful... :-)

-- 
Pablo Englebienne

"Progress is made by lazy men looking for easier ways to do things." - Robert A. Heinlein



Kent Johnson wrote:
> 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.
>
> Kent
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20081113/9fa517a4/attachment.htm>


More information about the Tutor mailing list