
30 Oct
2009
30 Oct
'09
10:16 a.m.
Am Freitag, 30. Oktober 2009 03:58:16 schrieb Steven D'Aprano:
To clarify point 3, given:
x = set.get() y = set.get()
then x and y will only be the same element if set has length one. However, given:
x = set.get() set.add(el) set.remove(el) y = set.get()
there are no guarantees about x and y being different.
I believe that the patch supplied by Willi Richart implemented these behaviours.
Actually, no. The patch makes no assumption about x and y being different.
It does not try to extend the core functionality of set nor does it need to maintain any state that would be necessary for that.
It is just a more obvious and cleaner way for saying "for x in some_set: break". So, as Raymond says, it is the Pythonic version of "arb" in setl.
wr