4 ms·
I'd desugar it like this: >>> lookup = {} >>> for (x, lookup[x]) in ('ab', 'cd', 'ef'): ... pass ... >>> lookup {'a': 'b', 'c': 'd
by theamk 8y ago
I'd desugar it like this:
>>> lookup = {}
>>> for (x, lookup[x]) in ('ab', 'cd', 'ef'):
... pass
...
>>> lookup
{'a': 'b', 'c': 'd', 'e': 'f'}
This makes is much more clear that there is just a double assignment, and that comprehension are pretty close to regular `for` statement.
(this was a great example btw -- I write python3 a lot, and I was staring at it for a long time before Icould figure it out)