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/039189.html below:

[Python-Dev] accumulator display syntax

[Python-Dev] accumulator display syntax [Python-Dev] accumulator display syntaxSkip Montanaro skip at pobox.com
Tue Oct 21 16:23:15 EDT 2003
    Guido> Here's the rule I'd propose for iterator comprehensions, which list
    Guido> comprehensions would inherit:

    Guido>     [<expr1> for <vars> in <expr2>]

    Guido> The variables in <vars> should always be simple variables, and
    Guido> their scope only extends to <expr1>.  If there's a variable with
    Guido> the same name in an outer scope (including the function
    Guido> containing the comprehension) it is not accessible (at least not
    Guido> by name) in <expr1>.  <expr2> is not affected.

I thought the definition for list comprehension syntax was something like

    '['
        <expr> for <vars> in <expr>
               [ for <vars> in <expr> ] *
               [ if <expr> ] *
    ']'

The loop <vars> in an earlier for clause should be visible in all nested for
clauses and conditional clauses, not just in the first <expr>.

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