DEV/Python
-
Computer Programming Languages: Why C Runs So Much Faster Than PythonDEV/Python 2021. 7. 26. 08:51
https://www.huffpost.com/entry/computer-programming-languages-why-c-runs-so-much_b_59af8178e4b0c50640cd632e Computer Programming Languages: Why C Runs So Much Faster Than Python Why is python slower than C? originally appeared on Quora - the place to gain and share knowledge, empowering people to learn from others and better unde... www.huffpost.com 나중에 읽어보기! 답변한 사람은 Apple Core OS Kernel 팀의 테리 램..
-
Formatting!DEV/Python 2021. 7. 20. 13:07
유다시티 과제하는데 포맷팅에서 빠꾸를 먹었다. 테스트 코드 다 통과해서 가볍게 넘길 줄 알았는데! ㅋㅋ Always keep in mind that there are a plethora of command-line tools (pycodestyle, pylint) or websites (http://pep8online.com/) to check if the violations aren’t egregious (e.g. long lines, a few style missteps, but mostly clean and well-formatted), PEP8 online check pep8online.com Great job. It’s important that the docstring comments that..
-
collections.CounterDEV/Python 2021. 7. 19. 10:42
https://docs.python.org/3/library/collections.html#collections.Counter collections — Container datatypes — Python 3.9.6 documentation collections — Container datatypes Source code: Lib/collections/__init__.py This module implements specialized container datatypes providing alternatives to Python’s general purpose built-in containers, dict, list, set, and tuple. namedtuple() factory f docs.python..
-
네이밍 컨벤션DEV/Python 2021. 7. 18. 11:26
https://visualgit.readthedocs.io/en/latest/pages/naming_convention.html Python Naming Conventions — CodingConvention 0 documentation © Copyright 2014, Dev Team. visualgit.readthedocs.io 변수에서 단어가 복합어일 때 언더스코어(_)를 넣어서 구분해주는 것이 흔한 컨벤션이라는데 자꾸 카멜케이스로 변수명을 만들고 있었다 ^^;;
-
Python Decorator with MemoizationDEV/Python 2021. 7. 13. 09:45
자바스크립트에서도 많이 예시로 드는 코드인데, Python에서는 Decorator를 사용하여 아래와 같이 cache attribute를 추가한 후, 이미 계산된 값이면 바로 돌려주고 아니면 계산을 해서 값을 저장하는 단계를 추가로 거치도록 하여 memoization 할 수 있다. import functools from decorators import count_calls def cache(func): """Keep a cache of previous function calls""" @functools.wraps(func) def wrapper_cache(*args, **kwargs): cache_key = args + tuple(kwargs.items()) if cache_key not in wrappe..