Very simple request about argument setting.

Hieu Hoang dhhoa1 at student.monash.edu
Mon Oct 30 00:15:26 EST 2006


Hi,

The shuf() function returns two values: x and foo.
The command
>>> x,foo,bar=shuf(1,2,3,4,5,6,7,8)
becomes
>>> x,foo,bar=x,foo

So, this command assigns 2 values (x and foo) to 3 variables (x, foo 
and bar), which raises that exception. I'm not sure why python says 
"need more than 2 
values to unpack" not "need 3 values" though.

Hope this help,
Rooy



More information about the Python-list mailing list