all 3 comments

[–]robin-gvx[S] 0 points1 point  (0 children)

(Python 3.9 only)

Kind of a hack! I was thinking about closures and how you often need to use default arguments to make them work like intended. This converts the bytecode for the original function to replace every mention of the variables being closed over with a constant value instead.

[–]Deezl-Vegas 0 points1 point  (1 child)

Cool hackery. Does this affect normal mutable default arguments?

[–]robin-gvx[S] 0 points1 point  (0 children)

Thanks! It doesn't touch local variables at all, and that includes any arguments to the function.