파이썬의 퍼스크 클래스 함수에 관한 글입니다. 


퍼스트 클래스 시민에 대한 글을 먼저 보고 오시면 좋을 듯 합니다.


In computer science, a programming language is said to have first-class functions if it treats functions as first-class citizens. Specifically, this means the language supports passing functions as arguments to other functions, returning them as the values from other functions, and assigning them to variables or storing them in data structures.
- 위키피디아


퍼스트 클래스 함수(First Class Function)란 함수를 퍼스트 클래스 시민(first-class citizens)으로 다루는 것을 의미합니다. 


즉, 변수에 담을 수 있고, 함수의 인자로 전달하고 함수의 리턴 값(return value)로 전달할 수 있는 함수입니다.



함수를 퍼스트 클래스 객체로 다룰 수 있게 지원하는 것은 함수형 언어의 특징이라고 합니다. 그렇다면 객체지향 언어인 파이썬(Everything is An Object)에서는 어째서 퍼스트 클래스 함수를 지원할까요?


그래서 주변에 물어봤는데 대부분의 답변은 다양하고 기발한 코딩이 가능하기 때문이라고 합니다. 그에 대한 예시로는 데코레이터, 익명 함수 등이 있을 것입니다.



퍼스트 클래스 함수는 후의 클로저(closure)라는 개념을 공부할 때 이어집니다.



출처


https://en.wikipedia.org/wiki/First-class_function


http://bestalign.github.io/2015/10/18/first-class-object/


http://schoolofweb.net/blog/posts/%ED%8C%8C%EC%9D%B4%EC%8D%AC-%ED%8D%BC%EC%8A%A4%ED%8A%B8%ED%81%B4%EB%9E%98%EC%8A%A4-%ED%95%A8%EC%88%98-first-class-function/


http://blog.doortts.com/135


http://stackoverflow.com/questions/245192/what-are-first-class-objects

블로그 이미지

NCookie

,