Kent Johnson wrote:
> Stevie Broadfoot wrote:
>> actually scrap that, it works perfectly :) thank you very much for your 
>> help. One last question, does this only work on lists? or will tuples 
>> work too and what else?
> 
> It will work on any sequence including lists and tuples.

More precisely, it will work with any iterable - even a dict (which 
passes the *keys* of the dict) or a generator expression:

In [14]: def p(*args):
    ....:     print args
    ....:
    ....:
In [15]: p(*dict(foo=1, bar=2))
('foo', 'bar')
In [16]: p(*(x*x for x in range(4)))
(0, 1, 4, 9)

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to