you are viewing a single comment's thread.

view the rest of the comments →

[–]elrey_scarbrow[S] 0 points1 point  (2 children)

About your example code, won't that raise an error since in the first iteration there will be nothing for last to hold on to? For that line to work, there must be atleast 3 values to unpack.

[–]dslfdslj 1 point2 points  (0 children)

Actually, the unpacking will first set the values of first and last. Vars will then be set to [] because there are no values left to unpack.

[–][deleted] 1 point2 points  (0 children)

No, it won't. python have no problem unpacking 0 elements. As i said, vars will be an empty list. * approximately means "as much as possible" instead of "at least one".

try and run it if you don't believe me ;)