Python Iterables struggling using map() built-in

Chris Angelico rosuav at gmail.com
Mon Dec 8 04:50:44 EST 2014


On Mon, Dec 8, 2014 at 8:40 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> The first version is explicit and clear too. I'm sorry to say this, but
> it is true: if you (generic you) don't recognise that
>
>     while iters:
>         ...
>
>
> skips the while block if iters is an empty list, then *you* have a
> problem, not the code.

Of course it skips the body if iters starts out empty. The argument is
whether or not it makes sense to use this to mean "if iters: while
True:" because iters will never be changed. Is it abusing syntax or a
valid way to spell that condition?

ChrisA



More information about the Python-list mailing list