K
kj
Hi. I'd like to port a Perl function that does something I don't
know how to do in Python. (In fact, it may even be something that
is distinctly un-Pythonic!)
The original Perl function takes a reference to an array, removes
from this array all the elements that satisfy a particular criterion,
and returns the list consisting of the removed elements. Hence
this function returns a value *and* has a major side effect, namely
the target array of the original argument will be modified (this
is the part I suspect may be un-Pythonic).
Can a Python function achieve the same effect? If not, how would
one code a similar functionality in Python? Basically the problem
is to split one list into two according to some criterion.
TIA!
Kynn
know how to do in Python. (In fact, it may even be something that
is distinctly un-Pythonic!)
The original Perl function takes a reference to an array, removes
from this array all the elements that satisfy a particular criterion,
and returns the list consisting of the removed elements. Hence
this function returns a value *and* has a major side effect, namely
the target array of the original argument will be modified (this
is the part I suspect may be un-Pythonic).
Can a Python function achieve the same effect? If not, how would
one code a similar functionality in Python? Basically the problem
is to split one list into two according to some criterion.
TIA!
Kynn