Re: Very simple request about argument setting.

2006-10-30 Thread Fredrik Lundh
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

Re: Very simple request about argument setting.

2006-10-30 Thread Hieu Hoang
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

Re: Very simple request about argument setting.

2006-10-29 Thread Fredrik Lundh
[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

Re: Very simple request about argument setting.

2006-10-29 Thread [EMAIL PROTECTED]
Thank you very much for your information. -- http://mail.python.org/mailman/listinfo/python-list

Re: Very simple request about argument setting.

2006-10-29 Thread ArdPy
[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

Re: Very simple request about argument setting.

2006-10-29 Thread [EMAIL PROTECTED]
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

Re: Very simple request about argument setting.

2006-10-29 Thread ArdPy
[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

Very simple request about argument setting.

2006-10-29 Thread [EMAIL PROTECTED]
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.