On Sat, Feb 2, 2019 at 3:31 PM Steven D'Aprano <steve@pearwood.info> wrote:
The comprehension version isn't awful:

    [(a*2).name.upper() for a in seq]

but not all vectorized operations can be written as a chain of calls on
a single sequence.

If they are strictly parallel (no dot products) and you know when writing the code which variables hold vectors, then (denoting the vector variables by v1, ..., vn) you can always write

    [(expr with x1, ..., xn substituted for v1, ..., vn)
     for x1, ..., xn in zip(v1, ..., vn)]

which seems not much worse than the auto-vectorized version (with or without special syntax).

Haskell (GHC) has parallel list comprehension syntax (https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#parallel-list-comprehensions) so you don't have to explicitly call zip. I wouldn't mind having that in Python but I don't know what the syntax would be.