Rustom Mody writes: > On Saturday, January 18, 2014 2:06:29 PM UTC+5:30, Peter Otten wrote: > > > What would a list-comp with `let` or `where` look like? Would it > > win the beauty contest against the loop? > > For me this is neat > > [somefunc(mn,day,wd,name) for (then, name) in mylist let > (_,mn,dy,_,_,_,wd,_,_) = localtime(then)] > > Others may not find it so! > > See it across > 1 line (as I guess it will come after being posted!) > and its not so neat.
I would write that on three lines anyway, properly indented: [ somefunc(mn,day,wd,name) for (then, name) in mylist let (_,mn,dy,_,_,_,wd,_,_) = localtime(then) ] It could be made to use existing keywords: [ somefunc(mn,day,wd,name) for (then, name) in mylist with localtime(then) as (_,mn,dy,_,_,_,wd,_,_) ] -- https://mail.python.org/mailman/listinfo/python-list