In message <[email protected]>, Alain Ketterlin wrote:

> Lawrence D'Oliveiro <[email protected]_zealand> writes:
> 
>> What I don’t like is having that intermediate variable L leftover after
>> the computation.
> 
> Well, it also guarantees that the square root is computed once.

OK, this version should solve that problem, without requiring any new 
language features:

    V = tuple \
      (
            x
        /
            l
       for x in V
       for l in
           (math.sqrt(reduce(lambda a, b : a + b, (y * y for y in V), 0)),)
      )

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

Reply via email to