Very simple request about argument setting.

Hakusa at gmail.com Hakusa at gmail.com
Sun Oct 29 23:18:07 EST 2006


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

Besides which, I've been playing with this whole thing in the
interactive interpreter:

>>> def shuf(x,*foo, **bar):
... 	return x, foo
...
>>> x,foo,bar = shuf(1,2,3,4,5,6,7,8)
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
ValueError: need more than 2 values to unpack

I remember that two stars is for the second tuple, but how do I
distinguish between what var is for which tuple? I've tried using
brackets, braces, prenthisies, nothing seems to work. So what I am
doing wrong?




More information about the Python-list mailing list