본문 바로가기

분류 전체보기141

14. Callbacks and Lambdas in Python 1. Callback Function A callback function is a function that is passed as an argument to another function and is executed when a certain event or condition occurs. Callback functions are commonly used in asynchronous operations or when you want to perform a specific action when a certain event occurs. 2. Lambda Function A lambda function is a special syntax in Python for creating simple anonymous.. 2024. 3. 18.
14. 콜백함수와 람다함수 1. 콜백함수(callback function) 콜백 함수는 다른 함수에 인자로 전달되어, 어떤 이벤트나 특정 조건에서 실행되게 되는 함수를 말합니다. 콜백 함수는 주로 비동기 작업이나 특정 이벤트 발생 시점에 어떤 동작을 수행할 때 사용됩니다. 2. 람다 함수(Lambda Funciont) 람다 함수는 파이썬에서 익명의 간단한 함수를 생성하기 위한 특별한 구문입니다. "익명의 함수"라는 것은 함수에 고유한 이름이 지정되지 않았음을 의미합니다. 람다 함수는 일반적인 함수(def를 사용하여 정의)와는 달리, 한 줄로 표현되는 짧고 간결한 함수를 생성할 때 주로 사용됩니다. arguments: 람다 함수에 전달되는 인자들입니다. expression: 반환할 표현식입니다. 이 표현식의 값이 람다 함수가 호출될.. 2024. 3. 18.
13. Scope of Variable in Python 1. Scope in Python In Python, the scope of a variable refers to the region of the program where the variable can be referenced and modified. There are four main types of scopes in Python. 1-1. Local Local scope refers to variables defined within a function. They are only accessible within that function. 1-2. Enclpsing Enclosing scope refers to the scope of an outer function when referencing a va.. 2024. 3. 18.
13. 변수의 범위 1. 스코프(scope) 파이썬에서 변수의 범위(scope)는 해당 변수가 프로그램 내에서 참조되고 변경될 수 있는 영역을 의미합니다. 파이썬의 변수 범위는 크게 네 가지로 분류됩니다. 1-1. Local(지역) Local scope는 함수 내에서 정의된 변수. 해당 함수 내에서만 사용 가능. 1-2. Enclpsing(둘러싼 범위) Enclosing scope는 내부 함수에서 외부 함수의 변수를 참조할 때 해당 외부 함수 범위를 의미합니다. 1-3. Gloval(전역 범위) Global scope는 변수가 스크립트의 최상위 수준에서 정의될때 전체 스크립트 파일 내에서의 해당 변수로 사용됨을 의미합니다. 1-4. Built-in(내장 범위) Built-in scope는 파이썬의 내장 함수와 모듈들이 속하.. 2024. 3. 18.