4 ms·
If that were Haskell instead of python, it would still work, because tmp is never mutated. So it's not really state in that sense, it's just a binding. x i
by sullyj3 5y ago
If that were Haskell instead of python, it would still work, because tmp is never mutated. So it's not really state in that sense, it's just a binding.
x input = show tmp
where tmp = input * 5
It would be a different story if you had something like
class IntState:
def __init__(self, val):
self.val = val
def x(input):
self.val += input
return str(val)