On 10/08/2017 16:28, Steve D'Aprano wrote:

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]


--
Marco Buttu

INAF-Osservatorio Astronomico di Cagliari
Via della Scienza n. 5, 09047 Selargius (CA)
Phone: 070 711 80 217
Email: mbu...@oa-cagliari.inaf.it

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to