Sub:
PEP,Python_enhancement_proposal
Implementations:
Implementations:
CPython
IronPython (.NET)
Jython (JVM)
PyPy
Stackless Python
TinyPy
IronPython (.NET)
Jython (JVM)
PyPy
Stackless Python
스택,stack
http://www.stackless.com/
Stackless_Python
StacklessPython
https://wiki.python.org/moin/StacklessPython
MicroPythonhttp://www.stackless.com/
Stackless_Python
StacklessPython
https://wiki.python.org/moin/StacklessPython
TinyPy
Contents
2. 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()
3.2. all ¶
all()
iterable 내의 모든 요소에 대해 check하여 True or False를 반환
모두 참이거나 empty -> True
그 외의 경우 -> False
즉 iterable 내의 요소 중 단 하나라도 거짓이라면 False를 반환
CHK
iterable 내의 모든 요소에 대해 check하여 True or False를 반환
모두 참이거나 empty -> True
그 외의 경우 -> False
즉 iterable 내의 요소 중 단 하나라도 거짓이라면 False를 반환
CHK
이런것들 tbw
3.3. map ¶
map
ex. list of strings 내용을 대문자로 변환하기
names = ["alice", "bob", "charlie"] upper_names = list(map(str.upper, names))
3.5. reduce (이건 내장 함수 아님) ¶
reduce
내장 함수 아니므로 from functools import reduce 필요.
내장 함수 아니므로 from functools import reduce 필요.
이상 세 개 (map, filter, reduce), when to use:[1]
- 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
- 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
3.6. sorted ¶
sorted
ex. Sorting a list of strings based on their length[2]
words = ["apple", "banana", "cherry", "date"] sorted_words = sorted(words, key=lambda x: len(x))
4. decorator ¶
callable(x)에 함수를 넣으면 True, 변수를 넣으면 False가 나온다.
built-in은 reassign은 할 수 있지만, del로 없앨 수는 없다.
dir()
dir()
currying
filter(함수, 목록) - 함수값이 참인 것만 걸러냄
첫번째 인자: 함수는 boolean-valued_function.
두번째 인자: list, tuple등
반환값은 filter 유형의 값이지만 list() 함수를 이용하면 쉽게 리스트로 변환됨.
첫번째 인자: 함수는 boolean-valued_function.
두번째 인자: list, tuple등
반환값은 filter 유형의 값이지만 list() 함수를 이용하면 쉽게 리스트로 변환됨.
map(함수, iterable) - 각 항목에 함수를 적용함
zip(iterable, iterable, iterable, ...) - 동일한 개수로 이루어진 자료형을 tuple로 묶음
lambda args : expr
익명함수,anonymous_function 람다함수,lambda_function
익명함수,anonymous_function 람다함수,lambda_function
5. 환경/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
사이파이,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
7. Python - C ? (del ok, CLEANUP) ¶
Python - C(/C++ 가 거의 대부분이지만.. 암튼 기타 여러 언어) 간의 interoperability .. 서로간의 호출,call이나 Python을 C 소스로 변환하여 컴파일한다거나 등등... 에 대해 TBW
이것의 목적은 확장성, 이미 존재하는 라이브러리,library 활용, Python 실행 성능(속도) 개선, ....
10. Links en ¶
Algorithms implemented in Python
https://github.com/TheAlgorithms/Python
Note that https://news.ycombinator.com/item?id=18045491 (warning)
https://github.com/TheAlgorithms/Python
Note that https://news.ycombinator.com/item?id=18045491 (warning)