subexpressions

Tijs tijs_news at bluescraper.nl
Fri Jun 1 13:14:01 CEST 2007


Steve Howell wrote:
> 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.

No, x may be an object that has the __mul__ special method, and it may have
side effects. 

-- 

Regards,
Tijs



More information about the Python-list mailing list