In message <87sk2zhpcj....@dpt-info.u-strasbg.fr>, Alain Ketterlin wrote:
> Lawrence D'Oliveiro <l...@geek-central.gen.new_zealand> writes: > >> 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)),) >> ) > > You got the order wrong (it has to be for l ... for x ...) No, I deliberately put it in that order to ensure that the value for l can only ever be evaulated once. > You're kind of lucky here, because the arglist to tuple() provides a > scope that hides x and l. Be careful if you ever change tuple(...) to > [...], because x and l would leak to the outer scope (with python 2.*). Interesting. However, using “list( ... )” instead of “[ ... ]” also prevents the leakage. -- http://mail.python.org/mailman/listinfo/python-list