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/2001-June/015510.html below:

[Python-Dev] why not "return StopIteration"?

[Python-Dev] why not "return StopIteration"? [Python-Dev] why not "return StopIteration"?Barry A. Warsaw barry@digicool.com
Fri, 22 Jun 2001 12:30:44 -0400
>>>>> "GvR" == Guido van Rossum <guido@digicool.com> writes:

    |       - Calling an end() function would require two calls per
    |         iteration.  Two calls is much more expensive than one call
    |         plus a test for an exception.  Especially the time-critical
    |         for loop can test very cheaply for an exception.

Plus, if the exception is both raised and caught in C, it is never
instantiated, so exception matching is a pointer compare.  I know this
isn't the case with user defined iterators (since Python's raise
semantics is to instantiate the exception), but it helps.

-Barry



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