[Oren Tirosh] > > > Oh dear. If you are really going to do these these cutesy English-like > > > expressions I'd have to resurrect my old proposal of: > > > > > > if CONDITION for some NAME in ITERABLE: > > > if CONDITION for every NAME in ITERABLE: > > > if CONDITION for no NAME in ITERABLE: [Samuele Pedroni] > I would not dislike to have expression forms equivalent to applications of > > def every(pred,l): > for x in l: > if not pred(x): return False > return True > > def some(pred,l): > for x in in l: > if pred(x): return True > return False > > def such(pred,l,otherwise=None): > for x in in l: > if pred(x): return x > return otherwise > > as list comprehension is equivalent to map and filter. BTW, quantifiers can be efficiently implemented using functions in the itertools module. I'll add an example to the docs. Raymond Hettinger
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