Chris Stork wrote: > Now that there's a useful default meaning for pred, we should give > it a default and make it an optional argument. For this the order of > arguments must be reversed. This is different from itertools consistent > use of iterables as last arguments. I don't know if this is relevant > here. Anyway, since predicates are in general more useful like this > I think it's the better choice. Perhaps that's true for a piece of code given as an example. I don't think it would be sensible if, as you propose, these functions were to be put in the standard library, because there's something better to do with the default args for real applications. def any(pred, *iterables): I think the ability to work with multiple sequences (and not to have to use the argument order iter1, pred, iter2, ...) is more important than the ability to avoid typing "bool,". Another option would be def any(*iterables, pred=bool): for items in imap(None, *iterables): if pred(*items): return True return False which looks to me like it offers the best of both worlds. -- g
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