프로그래밍언어/파이썬(python)

python local variable lifecycle

바코94 2019. 8. 19. 17:10

local variable 의 life cycle은 variable이 위치한 해당 function이다.

 

c 언어의 block 이라는 것과 다른 점이다.

 

def fun():

    if True:

        a =3

    print(a)

 

--> 3이 출력된다.