How to inject variable into scope with a decorator?

前端 未结 11 2092
我寻月下人不归
我寻月下人不归 2020-12-04 17:31

[Disclaimer: there may be more pythonic ways of doing what I want to do, but I want to know how python\'s scoping works here]

I\'m trying to find a way to make a dec

11条回答
  •  Happy的楠姐
    2020-12-04 17:59

    You can't. Python has lexical scoping. That means the meaning of an identifier is determined solely based on the scopes that physically surround it when you look at the source code.

提交回复
热议问题