Alan G schrieb:
> My personal approach would be two separate comprehensions(*) which 
> keeps the intent very clear and keeps it short at the expense 
> of iterating the original list twice.

Of course this works only if condition(item) yields the same result each time
it is called with the same input (which should be the common case).

Also, iterating twice over the list could be expensive if the condition(item)
call takes comparatively long.

Chris
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to