Very simple request about argument setting.

Fredrik Lundh fredrik at pythonware.com
Mon Oct 30 11:58:06 CET 2006


Hieu Hoang wrote:

> 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.

probably because if you look at the call site

     x,foo,bar=shuf(1,2,3,4,5,6,7,8)

it's more helpful to learn that "shuf" returned 2 values than to learn 
that the code you're looking at requires three values.

</F>




More information about the Python-list mailing list