[Python-ideas] get method for sets?

Terry Reedy tjreedy at udel.edu
Thu May 17 00:41:46 CEST 2012


On 5/16/2012 4:09 AM, Mike Meyer wrote:

> Because next(iter(s)) makes the reader wonder "Why is this iterator
> being created?"

If s is a non-iterator iterable, to get at the contents of s 
non-destructively.

> makes me think that at the very least, this idiom ought to be
> mentioned in the documentation.

http://bugs.python.org/issue14836

> But my question was actually whether or not there was a reason for it
> not existing.

Because not all simple compositions need to be added to the sdtlib and 
builtins.

-- 
Terry Jan Reedy




More information about the Python-ideas mailing list