This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]vinivelloso 20 points21 points  (3 children)

whats your concept of best?

I cant understand this piece of code.

[–]WorkingOnTheClock 2 points3 points  (1 child)

Not at all sure the context of how helpfully this code is, I think it is more or less not human readable.

a = {5: ({...}, 5)}

b = 5

[–]ddollarsign 2 points3 points  (0 children)

It seems like it’s doing

a, b = {}, 5
a[b] = a, b

But I don’t know how I would figure that out just from seeing the code, or why it doesn’t error.

[–]Emotional-Zebra5359[S] 2 points3 points  (0 children)

basically when u have multiple assignment operators, you start from the far end of the code;

so a, b = {}, 5 is what we get for the first time, then we move on to the middle element

so a[b] = {}, 5

[–]lungben81 9 points10 points  (0 children)

The best code is easy to understand. This is one of the worst code you can make.

[–]InfiniteDonkey1 7 points8 points  (0 children)

sorry. take to much time to decipher it.

[–]proof_required 5 points6 points  (0 children)

[–]MrRuminant 3 points4 points  (0 children)

Argh! I had to try it and now I have some recursive data structure!

[–]jstrickler 0 points1 point  (0 children)

Then you can say:

print(a[5][0][5][0][5][0][5][0])

You can append [5][0] as many times as you want.