> With regard to generator expressions, isn't Guido leaning > back towards not having any variable capture? Right. > Or is he un-leaning-back again? This is all getting very > confusing... Paul Dubois told me he thought that an example I used in my keynote today (which would fail without capture) would be an attractive nuisance for scientists (since it looked just like a reasonable way to compute an outer product). I'm not sure the argument holds, because an outer product would typically be created as a list of lists, not a list of generators. The example I used was: F = [] for i in range(10): F.append(x*i for x in range(10)) It would end up creating 10 generators referencing the variable i with value 9. The version using list comprehensions of course works: F = [] for i in range(10): F.append([x*i for x in range(10)]) --Guido van Rossum (home page: http://www.python.org/~guido/)
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