Round and square brackets in one line python code

102 views Asked by At

I know it's not worth writing like that, but still, I'm very interested in what this tip is called and where can I find out more about it?

d = {}
for i in range(10):
    ({}, d)[i%2][i] = i ** 2

I understand what it's doing, but I didn't find the name, no matter how I tried to Google it.

0

There are 0 answers