
On 30 June 2013 17:26, Andrew Barnert <abarnert@yahoo.com> wrote:
If we removed that one difference, it would be even simpler. I don't think the difference buys us anything, and the cost of eliminating it is a relatively simple patch with minimal performance impact. (As a minor side benefit, that would also mean you could use the StopIteration hack in comps, but I still don't think we'd want to recommend doing that.)
An interesting rationale, especially along with your reply to Ron about how much simpler that approach is than attempting to optimize list(genexp), while still yielding a semantically equivalent end result. It still raises my "behavioural change without adequate justification" hackles, but I'm only -0 now, whereas I was definitely -1 earlier. It's definitely a much smaller change than the scoping one we introduced in the Python 3 migration, which had the dual motivation of moving the iteration variable into a private scope, and better aligning the other semantics of "[x for x in y]" vs "list(x for x in y)". Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia