Pablo Torres N.
tn.pablo at gmail.com
Fri Jul 3 05:17:32 CEST 2009
On Jul 2, 9:56 pm, schickb <schi... at gmail.com> wrote:
> I have fairly often found the need to split a sequence into two groups
> based on a function result. Much like the existing filter function,
> but returning a tuple of true, false sequences. In Python, something
> def split(seq, func=None):
> if func is None:
> func = bool
> t, f = , 
> for item in seq:
> if func(item):
> return (t, f)
> The discussion linked to below has various approaches for doing this
> now, but most traverse the sequence twice and many don't apply a
> function to spit the sequence.http://stackoverflow.com/questions/949098/python-split-a-list-based-o...
> Is there any interest in a C implementation of this? Seems too trivial
> to write a PEP, so I'm just trying to measure interest before diving
> in. This wouldn't really belong in intertool. Would it be best
> implemented as a top level built-in?
This sounds like it belongs to the python-ideas list. I suggest
posting there for better feedback, since the core developers check
that list more often than this one.
More information about the Python-list