[BangPypers] Generate Dynamic lists

Gora Mohanty gora at mimirtech.com
Mon Nov 7 06:11:31 CET 2011


On Fri, Oct 21, 2011 at 6:12 AM, Saager Mhatre <saager.mhatre at gmail.com> wrote:
[...]
> While I'd usually suggest a list comprehension like...
>
> [(criteria, level) for level in range(1, 4) for criteria in
> criteria_list[:2]]
[...]

List comprehensions would indeed be the Pythonic way
to do it. The idea here was to get clarifications on what
the original poster wanted, and give him an example of
the same, rather than having him get bogged down in
understanding syntax.

Regards,
Gora


More information about the BangPypers mailing list