Steve Howell showell30 at
Fri Jun 1 12:55:18 CEST 2007

--- Sergey Dorofeev <sergey at> wrote:
> > What syntax would you suggest for a lambda
> enhanced to cover your use 
> > case?
> > I suppose you will end up with roughly the same
> number of characters, all
> > crammed in one line -- or broken into lines at a
> random position as it
> > happens with overambitious list comprehensions.
> Agree, this argument is strong.

FWIW there's the possibility that even without a
subexpression syntax, some Python implementations
would detect the duplication of x*x and optimize that
for you.  It would have to know that x*x had no side
effects, which I think is a safe assumption even in a
dynamic language like Python.

I know the CPython implementation does do some types
of optimizations (peephole, etc.), but I'm not expert
enough to know whether this kind of optimization would
be detected.

Sick sense of humor? Visit Yahoo! TV's 
Comedy with an Edge to see what's on, when.

More information about the Python-list mailing list