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
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 t
[EMAIL PROTECTED] wrote:
> ArdPy wrote:
>> There is an error in the syntax the star must prefix the variable name
>> not suffix it.
>> Then the items variable will accept the parameter value as a tuple.
>
> Hmm, tuples are immutable, right? I need something mutable so that when
> the player picks
Thank you very much for your information.
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> ArdPy wrote:
> > There is an error in the syntax the star must prefix the variable name
> > not suffix it.
> > Then the items variable will accept the parameter value as a tuple.
>
> Hmm, tuples are immutable, right? I need something mutable so that when
> the player pic
ArdPy wrote:
> There is an error in the syntax the star must prefix the variable name
> not suffix it.
> Then the items variable will accept the parameter value as a tuple.
Hmm, tuples are immutable, right? I need something mutable so that when
the player picks up an item, it's no longer in the r
[EMAIL PROTECTED] wrote:
> I have the argument items in my class room.
>
> class room:
> def __init__(self, name, description, items*):
>
> I thought I remembered from a tutorial I read once, and I've read so
> many I feel like an expert of them, that putting a little star* above
> an item m
I have the argument items in my class room.
class room:
def __init__(self, name, description, items*):
I thought I remembered from a tutorial I read once, and I've read so
many I feel like an expert of them, that putting a little star* above
an item makes it accept the argument as a list.