
[Chris Angelico <rosuav@gmail.com>]
... For it to be accepted, you have to convince people - particularly, core devs - that it's of value. At the moment, I'm unconvinced, but on the other hand, all you're proposing is a default value for a currently-mandatory argument, so the bar isn't TOO high (it's not like you're proposing to create a new language keyword or anything!).
Except it's not that simple: def gen(hi): i = 0 while i < hi: yield i i += 1 from itertools import compress g = gen(12) print(list(filter(None, g))) g = gen(12) print(list(compress(g, g))) Which displays: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] [0, 2, 4, 6, 8, 10] The first is obviously intended, but the latter is what you get merely by giving the same argument twice to `complress()`. `compress()` can't materialize its argument(s) into a list (or tuple) first, because it's intended to work fine with infinite sequences. It could worm around that like so:under the covers: from itertools import tee g = gen(12) print(list(compress(*tee(g)))) but that's just bizarre ;-) And inefficient. Or perhaps the `compress()` implementation could grow internal conditionals to use a different algorithm if the second argument is omitted. But that would be a major change to support something that's already easily done in more than one more-than-less obvious way.