On Sat, Dec 24, 2011 at 6:40 AM, Gnarlodious <gnarlodi...@gmail.com> wrote:
> [(imp.find_module(module)[1], os.path.getmtime(imp.find_module(module)[1])) 
> for module in modules]
>
> Can I in some way assign imp.find_module(module)[1] to a variable and reuse 
> it? Is this a job for lambda?

Well, you can use an additional comprehension to provide a temporary
variable, if you really want to do it all as a single expression.

[(m, os.path.getmtime(m)) for m in (imp.find_module(module)[1] for
module in modules)]

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to