>> ?!?! When listcomps were introduced, you were strongly against any >> changes that would make it difficult to switch back and forth between >> a listcomp and its corresponding equivalent for loop. Guido> I don't recall what I said then. Did I say it was a feature that Guido> L = [x for x in R] Guido> print x Guido> would print the last item of R? I suspect the lack of a PEP at the time list comprehensions were added to the language allowed this to slip through. PEP 202 was mostly written after list comprehensions were checked into CVS I think (opened 2000-07-13, marked final 2001-08-14, yes 2001!). At just 84 lines it's one of the shortest PEPs. The patch I opened on SF (#400654, opened 2000-06-28, closed 2000-08-14) was essentially Greg Ewing's experimental patch, which relied heavily on the existing for loop code generation. Had there been a PEP with the usual fanfare, I suspect we'd have caught (or at least considered) variable leakage, and perhaps suppressed it. I don't recall the topic ever coming up until after list comps were part of the language. It certainly seems to be the most controversial aspect, after one accepts the idea of adding them to the language. Missing such an obvious point of contention is perhaps one of the strongest arguments for the current PEP process. Skip
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