Timeline for Lazy evaluation function decorator
Current License: CC BY-SA 4.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 3, 2019 at 17:18 | comment | added | Peter Taylor |
@Peilonrayz, the obvious approach would be to use a separate Boolean variable. An alternative, which I consider hackier, would be to not have a separate variable for internal_state at all: result = function(); function = lambda () => result; return result
|
|
May 3, 2019 at 17:09 | comment | added | cglacet |
My function never return None , but in the general case I guess that you would just have a boolean marker beside the internal_state , so you can tell if the function has been evaluated or not, but that's just a guess and probably not the best solution either. Concerning the cache solution I'll have a look at it.
|
|
May 3, 2019 at 16:48 | comment | added | Peilonrayz♦ |
So how do you change the code with regard to the first point if None is a valid return?
|
|
May 3, 2019 at 16:44 | history | answered | Peter Taylor | CC BY-SA 4.0 |