
My 2c: I don't remember ever seeing itertools.compress (although I've occasionally browsed through itertools), and I've certainly never used it. However, having worked out what it does, my first reaction was that this would be a harmless and mildly convenient change. But might it not lead to bugs if the second argument were accidentally omitted? Best wishes Rob Cliffe On 13/09/2021 12:07, ml@dyatkovskiy.com wrote:
Hi!
I propose to enhance "itertools.compress" in such a way so if you don't provide selectors, then "data" itself is used as a selectors. So "compress(a)" would be equivalent to "compress(a, a)"
For example:
from itertools import compress
[*compress([0, 1, 2, 3]))] [1, 2, 3]
[*compress(["", "CFLAGS=-O3"])] ["CFLAGS=-O3"]
opts = compress([None, "", "-filove-python", "CFLAGS=-O3"]) " ".join(opts) '-filove-python CFLAGS=-O3'
What do you think guys about this? Perhaps it was proposed by someone else?
Thanks! Stepan Dyatkovskiy _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/LVD63O... Code of Conduct: http://python.org/psf/codeofconduct/