Re:WTFPython – Understanding Python through surprising snippets
by edflsafoiewq on Monday December 23, 2019 @04:23AM
(#21862427)
I don't find this at all unexpected. In an imperative language I expect a loop to be implemented by mutating a common variable.
[ Parent
| on HN ]
Re:WTFPython – Understanding Python through surprising snippets
by owl57 on Monday December 23, 2019 @04:57AM
(#21862590)
Imperative loop, maybe. But list comprehensions are a sublanguage imported from Haskell and looking like Haskell, so it's somewhat natural to be surprised by mutable variables here.