On 12 June 2013 19:47, Terry Reedy <[email protected]> wrote:
> The proper loop statement
>
> for s in songs:
> (new_songs if s.is_new() else old_songs).append(s)
I think I would just end up rewriting this as
for s in songs:
if s.is_new():
new_songs.append(s)
else:
old_songs.append(s)
but then we're back where we started. I don't think any of the
solutions posted in this thread have been better than this. If you
want to make this a nice one-liner then just put this code in a
function.
Oscar
--
http://mail.python.org/mailman/listinfo/python-list