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-le...@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/LVD63OEWRTTU542NKFODLERXCM7LEQ5D/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to