The function returns an element inside the container, and the author wants sock attached to the element, not the container.
Here is a simpler example of this syntax:
>>> def foo(): ... return ['potato'] ... >>> [p] = foo() >>> p 'potato'
source share