Christopher Barker writes:
> How do you divide a sequence into two sequences cleanly?
I don't know how to do it in a one liner, but
yes = []
no = []
for elem in seq:
(yes if test(elem) else no).append(elem)
seems pretty clean to me.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/BBVBDT7KJTTOD5VQYIHBCQBU5QV32ZUB/
Code of Conduct: http://python.org/psf/codeofconduct/