> > How about this? > > > > if any(x==5 for x in seq): > > Aren't all of these equivalent to: > > if 5 in seq: > ... Of course. However, the original example was pretty clearly intended to be an illustrative instance of a more general problem. Rewriting the example as any(x==5 for x in seq) preserves the generality; rewriting it as 5 in seq doesn't.
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