On Sat, Oct 15, 2011 at 9:30 AM, Tim Chase <python.l...@tim.thechases.com> wrote: > The double-if is new to me. I thought it was an error when I first saw it, > but it seems to be legit syntax (or at least one that 2.7 tolerates, > intentionally or otherwise...). I think I'd make it clearer with either > >
Yeah, it's legal because you can nest fors and ifs in a list comp. Stylistic difference, I used "if" instead of "and" because there's no way that it could be a bitwise and. (It's a cross-language safety net that I sometimes use.) Although the 10<=i<=20 option is definitely superior to both. ChrisA -- http://mail.python.org/mailman/listinfo/python-list