En Fri, 03 Jul 2009 01:58:22 -0300, <//phr...@nospam.invalid>> escribió:

"Pablo Torres N." <tn.pa...@gmail.com> writes:
def split(seq, func=bool):
        t = filter(func, seq)
        f = filter(lambda x: not func(x), seq)
        return list(t), list(f)

That is icky--you're calling func (which might be slow) twice instead
of once on every element of the seq.

In addition, this doesn't work if seq is an iterator instead of a sequence.

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to