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. > > http://bugs.python.org/issue7212 >
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 _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com