[Tutor] Is this a job for zip(), or some other way?

Gregor Lingl glingl at aon.at
Sun Mar 28 14:52:45 EST 2004


>
>I see it as  analogue to the definition of functions where something
>like 
>     def f(*args): pass
>means to collect all arguments in a tuple.  Using that syntax in a call
>does the opposite (people who know Lisp may know that from macros where
>you can slice a sequence with `,@').
>
>
>  
>
And people who know only Python may know that from sequence unpacking:

 >>> u,v,w="abc"
 >>> print u,v,w
a b c
 >>> def fun(u,v,w):
    print u,v,w

   
 >>> fun(*"abc")
a b c

Right?

Gregor

>   Karl
>  
>



More information about the Tutor mailing list