[Python-ideas] PEP 572: Statement-Local Name Bindings

Stephen J. Turnbull turnbull.stephen.fw at u.tsukuba.ac.jp
Thu Mar 1 04:46:05 EST 2018


Chris Angelico writes:

 > Memoization can only be done for pure functions.

True, but when for impure f you naively construct a list [f(x), f(x)],
substituting [(f(x) as wrong), wrong] is just [wrong, wrong] ;-),
because the side effect doesn't get reevaluated.

Steve



More information about the Python-ideas mailing list