In message <877hkdhyl5....@dpt-info.u-strasbg.fr>, Alain Ketterlin wrote:

> Lawrence D'Oliveiro <l...@geek-central.gen.new_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