[Tutor] Aschenputtel problem

Christopher Arndt chris.arndt at web.de
Fri Sep 16 03:48:08 CEST 2005


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


More information about the Tutor mailing list