In <[email protected]> Steve D'Aprano <[email protected]> writes:
> What would you expect this syntax to return? > [x + 1 for x in (0, 1, 2, 999, 3, 4) while x < 5] [1, 2, 3] > For comparison, what would you expect this to return? (Without actually > trying it, thank you.) > [x + 1 for x in (0, 1, 2, 999, 3, 4) if x < 5] [1, 2, 3, 4, 5] > How about these? > [x + y for x in (0, 1, 2, 999, 3, 4) while x < 5 for y in (100, 200)] [100, 101, 102, 200, 201, 202] > [x + y for x in (0, 1, 2, 999, 3, 4) if x < 5 for y in (100, 200)] [100, 101, 102, 103, 104, 200, 201, 202, 203, 204] -- John Gordon A is for Amy, who fell down the stairs [email protected] B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- https://mail.python.org/mailman/listinfo/python-list
