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

[Python-Dev] listcomps vs. for loops

[Python-Dev] listcomps vs. for loops [Python-Dev] listcomps vs. for loopsDelaney, Timothy C (Timothy) tdelaney at avaya.com
Tue Oct 21 19:11:44 EDT 2003
> From: Jp Calderone [mailto:exarkun at intarweb.us.avaya.com]
> 
>   Not when x is properly initialized.  Anyway, this is no 
> different from the
> problem of:
> 
>     for x in R:
>         ...
>     print x

For which reason I propose that Python 3.0 have the control name in any for expression be "local" to the expression ;)

Hmm - actually this does raise another issue.

    >>> x = 1
    >>> y = [1, 2, 3]
    >>> y = [x for x in y]

Using the current semantics:

    >>> print x
    3

Using the new semantics:

    >>> print x
    1

Is this a problem? Are the new semantics going to cause confusion?

Tim Delaney

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