A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-November/093804.html below:

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

[Python-Dev] Retrieve an arbitrary element from a setwithoutremoving it [Python-Dev] Retrieve an arbitrary element from a setwithoutremoving itAlexander Belopolsky alexander.belopolsky at gmail.com
Thu Nov 5 22:09:11 CET 2009
On Thu, Nov 5, 2009 at 3:43 PM, Chris Bergstresser <chris at subtlety.com> wrote:
> .. and "x = iter(s).next()" raises a StopIteration
> exception.

And that's why the documented recipe should probably recommend
next(iter(s), default) instead.  Especially because iter(s).next() is
not even valid code in 3.0.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4