zip() : how about braid()

Robin Becker robin at jessikat.fsnet.co.uk
Thu Jul 20 03:43:04 EDT 2000


In article <397681C6.FEAEE2E at my.signature>, Greg Ewing
<see at my.signature> writes
>Michal Wallace wrote:
>> 
>> braid(), as in hair..
>
>Um, not quite, that suggests two or more strands being
>twisted around each other somehow, such as
>
>   braid([1, 2, 3], ['a', 'b', 'c']) = [(1,'a'), ('b',2), (3,'c')]
>
>:-)
>
well surely we're not just going to require only two arguments if we use
a function or are we. I use

>>> map (None, [1, 2, 3], ['a', 'b', 'c'], [11,12,13])
[(1, 'a'), (2, 'b'), (3, 'c')]
>>> map (None, [1, 2, 3], ['a', 'b', 'c'], [11,12,13])
[(1, 'a', 11), (2, 'b', 12), (3, 'c', 13)]
>>> 

quite happily. If zip or braid or whatever is selected it should at
least accept arbitrary numbers of arguments.
-- 
Robin Becker



More information about the Python-list mailing list