A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2009-October/093245.html below:

[Python-Dev] Retrieve an arbitrary element from a set without removing it

[Python-Dev] Retrieve an arbitrary element from a set without removing it [Python-Dev] Retrieve an arbitrary element from a set without removing itPaul Moore p.f.moore at gmail.com
Fri Oct 23 20:13:33 CEST 2009
2009/10/23 John Arbash Meinel <john.arbash.meinel at gmail.com>:
> I was pretty surprised that it was 30% faster than "for x in s: pass". I
> assume it has something to do with a potential "else:" statement?

I'd imagine it's actually because it has to call next() a second time
and deal with the StopIteration exception - the loop has to end
normally, whereas the break form exits prematurely.

Paul.
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