Chris Bergstresser]
I like the proposed set.get() method, personally.

Sets have been implemented in many languages, but I've only seen one that implemented this functionality (the "arb" function in SETL). For the most part, it seems that this is an uncommon need.

Also consider that there is value to keeping the set-api as
simple as possible.  Right now, anyone who was exposed
to the basics of sets in school can understand the set-api
with a near zero learning curve.  Some of that would be
lost if you add methods that make identity/equality distinctions
or that fetch the same arbitrary value over and over again.

Besides, it is trivial to write a short function that encapsulates
this behavior if it is part of your personal style of expression.



  The existing methods aren't great for accomplishing this, mainly
because they're obfuscatory.  "iter(s).next()" is probably clearest,
and at least will throw a StopIteration exception if the set is empty.
"for x in s: break" is just confusing ...

A short comment would do wonders.


Raymond


P.S.  It is weird that this thread is gaining traction at the same
time as the moratorium thread.  Go figure :-)
_______________________________________________
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

Reply via email to