[Python-Dev] Retrieve an arbitrary element from a setwithoutremoving it

Raymond Hettinger python at rcn.com
Thu Nov 5 23:30:56 CET 2009


[Chris Bergstresser]
 > Clearly, I'll need to write up the PEP.

Why not write a short, fast get_first() function for your utils directory and be done with it?
That could work with sets, mappings, generators, and other containers and iterators.
No need to fatten the set/frozenset API for something so trivial and so rarely needed.


Raymond


More information about the Python-Dev mailing list