[issue7212] Retrieve an arbitrary element from a set without removing it

Alexander Belopolsky report at bugs.python.org
Thu Nov 5 19:57:35 CET 2009


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

I don't want to pollute python-dev with more hopeless ideas, but I wonder 
if itertools could grow an efficient C-implemented

def first(collection):
   return next(iter(collection))

On the other hand, it probably belongs to recipes more than stdlib.  This 
is not really an iterator tool after all.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7212>
_______________________________________


More information about the Python-bugs-list mailing list