[Tutor] Aschenputtel problem
alan.gauld at btinternet.com
Thu Sep 15 23:13:02 CEST 2005
> I wonder if there is a shorter form of the following idiom:
Bearing in mind that shorter is not necessarily better...
[condition(i) and list1.append(i) or list2.append(i) for i in
This returns a list of booleans that we throw away but the
list1,list2 containers will have been modified as required.
But the original code(below) is probably more reliable and
> list1 = 
> list2 = 
> for item in original_list:
> if condition(item):
> 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)
More information about the Tutor