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

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to