0

What does this code do?

f = [1]
x, = f

x is set to 1 after doing this, but I cannot figure out what the , = does.

Hyunjik Bae
  • 2,721
  • 2
  • 22
  • 32
  • 3
    It's just unpacking, as if you want to define `a, b = [1, 2]` – Mathieu Oct 28 '19 at 13:19
  • 2
    Unpacking it is. [e.g.](http://www.pythontutor.com/visualize.html#code=f%20%3D%20%5B1,%202%5D%0Ax,%20y%20%3D%20f&cumulative=false&curInstr=2&heapPrimitives=nevernest&mode=display&origin=opt-frontend.js&py=3&rawInputLstJSON=%5B%5D&textReferences=false) – user2165 Oct 28 '19 at 13:21

0 Answers0