2009/1/19 Vitor Bosshard <algorias at yahoo.com>: > Are you even sure the list comprehension doesn't already shortcut evaluation? > > This quick test in 2.6 hints otherwise: > > >>>> a = (i for i in range(10) if i**2<10) Yes, but your test, once it becomes true, remains so. Consider >>> list(n for n in range(10) if n%2 == 0) [0, 2, 4, 6, 8] I assume that the intention of the while syntax is: >>> list(n for n in range(10) while n%2 == 0) [0] because 1%2 != 0 so the loop stops. Having said that, I'm -1 on the proposal. The requirement is rare enough that the correct place for it *is* in a module - and that's what itertools provides (along with a number of other, equally valid, manipulations). I certainly don't see it as justifying new syntax. Paul.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4