Tuples -> Function Params?

Duncan Booth duncan at NOSPAMrcp.co.uk
Tue Dec 4 04:28:03 EST 2001


Philip Swartzleonard <starx at pacbell.net> wrote in
news:Xns916DB37570FARASXnewsDFE1 at 130.133.1.4: 

> Duncan Booth || Tue 04 Dec 2001 12:57:16a:
> 
>> Philip Swartzleonard <starx at pacbell.net> wrote in
>> news:Xns916D6505401FRASXnewsDFE1 at 130.133.1.4: 
>>> a,b,c = self.color glColor3f(a,b,c) 
>>> 
>>>          Ok, the question is, is there a way to do this where i
>>>          don't unpack  the tuple and pass sepearte arugments? 
>> 
>> Recent versions of Python:
>>    glColor3f(*self.color)
>> 
>> For older versions, use the apply function.
>> 
> 
> Thanks, both of you, that will mkae this more friendly i think :).
> Where can i go to read up on this * notation, i've only vaguely seen
> it before... 
> 

http://www.python.org/2.0/new-python.html#SECTION0001010000000000000000

Unfortunately this particular syntax doesn't yet seem to have made it into 
the main documentation.

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?



More information about the Python-list mailing list