by ianandrich · 5y ago · 0 comments
Two parts to this. 1: Does it mutate variables. 2. Does the code have side effects.
1: def no_mut(func): @functools.wraps def new_func(args, *kwargs): new_args = tuple(copy.deepcopy(arg) for arg in args) new_kwargs = {k, copy.deepcopy(v) for k, v in *kwargs return func(new_args, *new_kwargs) return new_func
For the second point, gevent seemed to have a trick to identify side effecting code.
No comments yet.