I'm struggling to find a pythonic way to move things from one list to another.
Eg.
list_of_things = [1, 2, 3, 4]
is_odd = lambda x: x % 2 != 0
odd_list = some_pythonic_operation(list_of_things, is_odd)
assert list_of_things == [2, 4]
assert odd_list == [1, 3]
Note: Please do not hyperfocus on the even/odd example and give a solution that handles just that case well, I'm looking for a general solution to this problem.
Note: I care very much about the performance and making sure this can be done in one pass, ideally in a readable pythonic way.