@cfbolz Had to run it. Didn't expect what I found. It seems to go like this.
(a, b) = {}, 5
a[b] = (a, b)
-
-
- View other replies
-
@okalotieno I figured it out in my head, but only because assignment had to go left to right, otherwise there would've been an exception ;-)
-
-
@cfbolz at least it does the same thing in py2 and py3, that's something :) -
@cfbolz The assignment order really makes no sense to me. -
@cfbolz If you think that's weird, what about: a = [1, 2] a[a.index(1)], a[a.index(2)] = 2, 1 -
-
@cfbolz Great exercise! Explanation with pythontutor : http://ow.ly/RsaxD
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
Carl Friedrich Bolz
Okal
Luka Kladaric
Jan Hermann
Samuele Pedroni
Aleksa Sarai
Henrique Bastos
Kmaschta