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/2003-October/039430.html below:

[Python-Dev] accumulator display syntax

[Python-Dev] accumulator display syntax [Python-Dev] accumulator display syntaxSkip Montanaro skip at pobox.com
Fri Oct 24 08:37:38 EDT 2003
    Tim>     squares = (f(x)**2 for x in inputs)  # assuming reiterability here

    Tim>     for f in math.sin, math.cos, math.tan:
    Tim>         plot(squares)

How much more expensive would this be than

    for f in math.sin, math.cos, math.tan:
        squares = (f(x)**2 for x in inputs)
        plot(squares)

which would work without reiterability, right?  The underlying generator
function could still be created at compile-time and it (or its code object?)
stored in the current function's constants.  'f' is simply an argument to it
when the iterator is instantiated.

Skip

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