28 May
2021
28 May
'21
5:18 a.m.
On Fri, 28 May 2021 at 13:11, Steven D'Aprano <steve@pearwood.info> wrote:
We might not even need new syntax if we could do that transformation using a decorator.
@static(var=initial) def func(): body
The problem here is injecting the "nonlocal var" statement and adjusting all of the references to the variable in body. I don't think that can be done short of bytecode manipulation. Paul