Sub: [[PEP,Python_enhancement_proposal]] Implementations: CPython IronPython (.NET) Jython (JVM) PyPy Stackless Python [[스택,stack]] http://www.stackless.com/ [[WpEn:Stackless_Python]] [[Wiki:StacklessPython]] https://wiki.python.org/moin/StacklessPython MicroPython TinyPy C 소스 64k줄로 된 최소화 구현. http://www.tinypy.org/ https://rosettacode.org/wiki/TinyPy [[TableOfContents]] = Learning Python = p72 파일 읽어서 실행 {{{exec(open('filename.py').read())}}} = Misc tmp notes = iterable을 iterator로 바꾸는 함수는 iter {{{a=[1,2,3,4] b=iter(a) next(b) 1 next(b) 2 list(b) [3,4]}}} generator는 함수 선언과 비슷 {{{def gen(): yield 1 yield 2 # yield from [1,2]로 쓸 수 있음 # type(gen)은 class 'function' gg=gen() # type(gg)는 class 'generator' next(gg) 1 next(gg) 2 next(gg) StopIteration }}} 모든 지역 변수들을 담은 딕셔너리를 돌려주는 내장 함수 vars() = 내장 함수 built-in functions = == vars == vars() == all == all() [[iterable]] 내의 모든 요소에 대해 check하여 True or False를 반환 모두 참이거나 empty -> True 그 외의 경우 -> False 즉 iterable 내의 요소 중 단 하나라도 거짓이라면 False를 반환 CHK 이런것들 tbw == map == map ex. list of strings 내용을 대문자로 변환하기 {{{ names = ["alice", "bob", "charlie"] upper_names = list(map(str.upper, names)) }}} == filter == filter == reduce (이건 내장 함수 아님) == reduce 내장 함수 아니므로 {{{from functools import reduce}}} 필요. 이상 세 개 (map, filter, reduce), when to use:[* https://blog.stackademic.com/20-python-concepts-i-wish-i-knew-way-earlier-40ed5674cd52] - `map()`: When you want to apply a function to every item of a collection. ([[적용,application]] [[함수적용,function_application]]) - `filter()`: When you need to select items based on a predicate. // [[술어,predicate]] - `reduce()`: When you want to cumulatively apply a function to items, reducing the sequence to a single value. // [[적용,application]] [[reduction]] == sorted == sorted ex. Sorting a list of strings based on their length[* https://blog.stackademic.com/20-python-concepts-i-wish-i-knew-way-earlier-40ed5674cd52] {{{ words = ["apple", "banana", "cherry", "date"] sorted_words = sorted(words, key=lambda x: len(x)) }}} ... Ggl:"파이썬 내장함수" Ggl:"Python built-in functions" = decorator = callable(x)에 함수를 넣으면 True, 변수를 넣으면 False가 나온다. built-in은 reassign은 할 수 있지만, del로 없앨 수는 없다. dir() currying filter(함수, 목록) - 함수값이 참인 것만 걸러냄 첫번째 인자: 함수는 boolean-valued_function. 두번째 인자: list, tuple등 반환값은 filter 유형의 값이지만 list() 함수를 이용하면 쉽게 리스트로 변환됨. map(함수, iterable) - 각 항목에 함수를 적용함 zip(iterable, iterable, iterable, ...) - 동일한 개수로 이루어진 자료형을 tuple로 묶음 lambda args : expr 익명함수,anonymous_function 람다함수,lambda_function = 환경/library/package = [[넘파이,NumPy]] [[사이파이,SciPy]] [[맷플럿립,Matplotlib]] for 2-D visualization [[심파이,SymPy]] for symbolic computing scikit-image for image processing [[사이킷런,scikit-learn]] AKA sklearn scikit-learn for [[기계학습,machine_learning]] [[파이토치,PyTorch]] - [[기계학습,machine_learning]] [[팬더스,Pandas]] - data analysis [[피지엠파이,pgmpy]] - 확률론, Bayesian_network = Books ko, 공개 책 = 공학자를 위한 Python https://wikidocs.net/book/1704 ---- = Python - C ? (del ok, CLEANUP) = Python - C(/C++ 가 거의 대부분이지만.. 암튼 기타 여러 언어) 간의 interoperability .. 서로간의 [[호출,call]]이나 Python을 C 소스로 변환하여 컴파일한다거나 등등... 에 대해 TBW 분류하기가 난감한데 어떤거 wrapper이기도 하고 어떤건 [[최적화,optimization]]이기도 하고 ... [[바인딩,binding]] etc. CLEANUP 이것의 목적은 확장성, 이미 존재하는 [[라이브러리,library]] 활용, Python 실행 성능(속도) 개선, .... == Cython == Cython { WpKo:사이썬 WpEn:Cython … Google:Cython } == SWIG == SWIG { … Google:SWIG } == 비교 == … Google:Cython+vs+SWIG = 다른 언어와의 비교 = == Ruby와 비교 == [[루비,Ruby]]와 비교 [[Wiki:PythonVsRuby]] = Links ko = = Links en = Ultimate Python study guide https://github.com/huangsam/ultimate-python Algorithms implemented in Python https://github.com/TheAlgorithms/Python Note that https://news.ycombinator.com/item?id=18045491 (warning) = History = 1989년 말 GvR이 시작. ABC(All Basic Code)에서 syntax를, Modula-3에서 error-handling technique를 참고해 가져옴. 1991년 초 public release. 2000년 Python 2.0 2008년 Python 3.0 (backward compatibility를 깸) ---- [[Wiki:PythonLanguage]] Up: [[언어,language]]/[[프로그래밍언어,programming_language]]