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

[Python-Dev] listcomps vs. for loops

[Python-Dev] listcomps vs. for loops [Python-Dev] listcomps vs. for loopsGuido van Rossum guido at python.org
Tue Oct 21 12:56:31 EDT 2003
> >  Anyway, this is no different from the
> > problem of:
> >
> >     for x in R:
> >         ...
> >     print x
> 
> Well, yes.  I still think it's dubious code.
> 
> > In any case, are there plans to also have the compiler emit
> > warnings about potential reliance on this feature?
> 
> I would hope that we wouldn't make changes without emitting such a
> warning.  I'm not sure how hard it would be to implement, tho'.

Warning about what?

I have no intent to make the example quoted above illegal; a regular
for loop control variable's scope will extend beyond the loop.

It's only list comprehensions where I plan to remove x from the scope
after the comprehension is finished.

Do you need a warning for that change too?  Code that relies on it is
pretty sick IMO.

--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