강의

멘토링

로드맵

Inflearn Community Q&A

jhryu12089922's profile image
jhryu12089922

asked

Programming for Us: Intermediate Python (Inflearn Original)

First-class functions - Closures Advanced (3-2)

closure_ex1()에서..

Resolved

Written on

·

296

0

안녕하세요! 의문점이 생겨 질문드립니다.

series = []도 지역변수 에리어에 선언되었는데,

왜 이 변수는 에러가 발생하지 않는건가요?

혹시, 리스트는 가변이 가능하고, 지역변수는 불변이라 그런게 맞을까요?

그리고 global과 nonlocal의 차이가 뭔가요?

nonlocal을 global로 대체했을때도 정상적으로 작동했기에 궁금증이 생겨 질문드립니다.

djangopython

Quiz

51% of people got it wrong. Give it a try!

Which of the following is possible when a function has the characteristics of a 'first-class object'?

Functions can be assigned to variables.

Functions are always initialized at compile time.

Functions cannot be passed as arguments to other functions.

Functions can only be defined within a class.

Answer 2

1

niceman님의 프로필 이미지
niceman
Instructor

언급하신대로 global vs unlocal에 관해 수업 내용과 같이 정확하게 이해하시면 됩니다.

길게 쓰는 것 보다는 아래에 정말 자세한 블로그가 있습니다. 시간날 때 꼭 읽어보세요.

https://www.programiz.com/python-programming/global-local-nonlocal-variables

-2

RYU님의 프로필 이미지
RYU
Questioner

감사합니다 이해되었습니다 ㅎㅎ

jhryu12089922's profile image
jhryu12089922

asked

Ask a question