Just relax, take it easy..

0%

Python - Note of Variable Scope

Watched an awesome video about python scope:
https://www.youtube.com/watch?v=QVdf0LgmICw

My clear summery of the video:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
''' LEGB:
Local, Enclosing, Global, Built-in
'''

''' Build-in variables '''
# import builtins
# print(dir(builtins))

x = 'global x'


def outer():
x = 'outer x'

def inner():
x = 'inner x'