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

[Python-Dev] PEP 289: Generator Expressions

[Python-Dev] PEP 289: Generator Expressions [Python-Dev] PEP 289: Generator ExpressionsGuido van Rossum guido at python.org
Thu Oct 23 11:35:56 EDT 2003
> I'm unclear on the meaning of the last line in detail #3, "(Loop
> variables may also use constructs like x[i] or x.a; this form may be
> deprecated.)"
> 
> Does this mean that "(x.a for x in mylist)" will initiatly be valid but
> will someday break?

No, I meant that "for x.a in mylist: ..." is valid but shouldn't be,
and consequently (because they all share the same syntax) this is also
allowed in list comprehensions and generator expressions.  All uses
should be disallowed.

> If so, I can't imagine why.  Or does in mean that
> the induction variable can be in that form, "(x for x.a in mylist)".
> Surely, this would never be allowed.

We can prevent it for generator expressions, but it's too late for
list comprehensions and regular for loops -- we'll have to go
deprecate it there.

--Guido van Rossum (home page: http://www.python.org/~guido/)

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