mirror of
https://github.com/satwikkansal/wtfpython
synced 2024-11-22 02:54:25 +01:00
Replace http link with https
This commit is contained in:
parent
669ff8c30e
commit
f735fe3116
2
wtfpython-pypi/content.md
vendored
2
wtfpython-pypi/content.md
vendored
@ -1732,7 +1732,7 @@ UnboundLocalError: local variable 'a' referenced before assignment
|
|||||||
|
|
||||||
#### 💡 Explanation:
|
#### 💡 Explanation:
|
||||||
* When you make an assignment to a variable in scope, it becomes local to that scope. So `a` becomes local to the scope of `another_func`, but it has not been initialized previously in the same scope which throws an error.
|
* When you make an assignment to a variable in scope, it becomes local to that scope. So `a` becomes local to the scope of `another_func`, but it has not been initialized previously in the same scope which throws an error.
|
||||||
* Read [this](http://sebastianraschka.com/Articles/2014_python_scope_and_namespaces.html) short but an awesome guide to learn more about how namespaces and scope resolution works in Python.
|
* Read [this](https://sebastianraschka.com/Articles/2014_python_scope_and_namespaces.html) short but an awesome guide to learn more about how namespaces and scope resolution works in Python.
|
||||||
* To modify the outer scope variable `a` in `another_func`, use `global` keyword.
|
* To modify the outer scope variable `a` in `another_func`, use `global` keyword.
|
||||||
```py
|
```py
|
||||||
def another_func()
|
def another_func()
|
||||||
|
Loading…
Reference in New Issue
Block a user