25 Jun
2018
25 Jun
'18
10:09 p.m.
On Mon, Jun 25, 2018 at 2:16 PM Steve Holden
I'd like to ask: how many readers of
this email have ever deliberately taken advantage of the limited Python 3 scope in comprehensions and generator expressions to use what would otherwise be a conflicting local variable name?
No, never, but the opposite has bitten me in production code (as I related several months back, a class-level variable was being used on the lhs of a comprehension and that failed when it was run in Py3). The caveat is that our code base is Py2+Py3, so we have the mindset that comprehension variables always leak.