Hi,

I wonder if there is a shorter form of the following idiom:

list1 = []
list2 = []
for item in original_list:
    if condition(item):
        list1.append(item)
    else:
        list2.append(item)

(optional step:)

original_list[:] = list1


I call this the "Aschenputtel" problem, because it is described by the famous
quote from the fairy tale as told by the Grimm brothers:

"Die guten ins Töpfchen, die schlechten ins Kröpfchen."

(The good ones in the pot, the bad ones in the crop)

Chris


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to