There are many ways to do this.  None of them avoids looping,
technically, although you can easily avoid the "for" syntax.

-- Simple but wastes some memory
    c = [i-j for i,j in zip(a,b)]

-- Using itertools.izip (python 2.3)
    c = [i-j for i,j in itertools.izip(a,b) ]

-- Generator expression (python 2.4)
    c = ( i-j for i,j in itertools.izip(a,b) )

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to