목록전체 글 (10)
YH Data Scientist의 정리글
이번 포스트는 코드 레이아웃 중 가져 오기에 대해서 정리하고자 합니다. 아래는 PEP 8 - Style Guide for Python Code 을 번역한 내용입니다. Imports Imports should usually be on separate lines: 가져 오기는 대개 별도의 줄에 있어야합니다. Yes: import os import sys No: import sys, os It's okay to say this though: 그래도 이렇게 쓸 수 있습니다: from subprocess import Popen, PIPE Imports are always put at the top of the file, just after any module comments and docstrings, and b..
이번 포스트는 코드 레이아웃 중 소스 파일 인코딩에 대해서 정리하고자 합니다. 아래는 PEP 8 - Style Guide for Python Code 을 번역한 내용입니다. Source File Encoding Code in the core Python distribution should always use UTF-8 (or ASCII in Python 2). 핵심 Python 배포판의 코드는 항상 UTF-8 (또는 Python 2의 ASCII)을 사용해야 합니다. Files using ASCII (in Python 2) or UTF-8 (in Python 3) should not have an encoding declaration. ASCII (Python 2) 또는 UTF-8 (Python 3)을 사..
이번 포스트는 코드 레이아웃 중 빈 줄에 대해서 정리하고자 합니다. 아래는 PEP 8 - Style Guide for Python Code 을 번역한 내용입니다. Blank Lines Surround top-level function and class definitions with two blank lines. 두 개의 빈 줄로 최상위 함수 및 클래스 정의를 둘러싸십시오. Method definitions inside a class are surrounded by a single blank line. 클래스 내부의 메소드 정의는 단일 빈 줄로 둘러싸십시오. Extra blank lines may be used (sparingly) to separate groups of related functions. ..