Split a list into two parts based on a filter?

Fábio Santos fabiosantosart at gmail.com
Mon Jun 10 19:08:46 EDT 2013


On 10 Jun 2013 23:54, "Roel Schroeven" <roel at roelschroeven.net> wrote:
>
> You could do something like:
>
> new_songs, old_songs = [], []
> [(new_songs if s.is_new() else old_songs).append(s) for s in songs]
>
> But I'm not sure that that's any better than the long version.

This is so beautiful!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130611/92f9bcca/attachment.html>


More information about the Python-list mailing list