Proposed new syntax
Marco Buttu
marco.buttu at gmail.com
Wed Aug 16 09:48:58 EDT 2017
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: mbuttu at oa-cagliari.inaf.it
More information about the Python-list
mailing list