[Python-Dev] Efficient predicates for the standard library
Christian Stork
cstork at ics.uci.edu
Sun Oct 5 05:59:54 EDT 2003
On Sun, Oct 05, 2003 at 12:26:48AM -0400, Jeremy Fincher wrote:
...
> > def some(pred, seq):
> > "Returns True if pred(x) is True at least one element in the iterable"
> > return True in imap(pred, seq)
> >
> > def no(pred, seq):
> > "Returns True if pred(x) is False for every element in the iterable"
> > return True not in imap(pred, seq)
>
> I would instead call some "any" (it's more standard among the functional
> languages I've worked with), and I wouldn't bother with "no," since it's
> exactly the same as "not any" (or "not some," as the case may be).
Yep, seems better.
--
Chris Stork <><><><><><><><><><><><><> http://www.ics.uci.edu/~cstork/
OpenPGP fingerprint: B08B 602C C806 C492 D069 021E 41F3 8C8D 50F9 CA2F
More information about the Python-Dev
mailing list