Flashes Home Search Notifications Sign in Post
Monty @ The Python Coding Place @thepythoncodingplace.com · Mar 15

Python refers to the enclosing scope as the non-local scope, and there's a `nonlocal` keyword you can use in the inner function to make sure you use the same `counter` in the enclosing scope, and not a new local variable within `wrapper()` And now the error has gone:

0 likes 1 replies

?

Replies

Monty @ The Python Coding Place · Mar 15

Now, you can try to call the decorated `do_something()` several times

Legal

Privacy Policy Terms and Conditions

Contact

Support FAQs

Follow

Bluesky Instagram Threads
Flashes for Bluesky Get it on the App Store