[Python-Dev] Temporary Constantification

Aahz aahz at pythoncraft.com
Mon Jun 26 00:22:04 CEST 2006

On Sun, Jun 25, 2006, Eric Sumner wrote:
> In general, a cached value can be used (rather than re-evaluating the
> expression) if:
>   - The expression has no side effects,
>   - The result of all operations is deterministic, and
>   - None of the expression parameters have changed since the cached
> value was generated
> The first two can be determined at compile-time without too much
> difficulty (except possibly function calls, I'll get to those in a
> minute).  

Except for properties.  So you'd have to allow only bare names, no
attributes.  You'd also have to restrict values to immutable ones.
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"I saw `cout' being shifted "Hello world" times to the left and stopped
right there."  --Steve Gonedes

More information about the Python-Dev mailing list