<aside> 💡

🔹 PEP8과 PEP20을 따르기 위한 요약

🔹 PEP8 (Python Enhancement Proposal 8)

<aside> 💡

PEP8은 Python 코드 스타일을 일관되게 작성하기 위한 공식적인 가이드라인입니다. 주요 규칙을 아래와 같이 정리할 수 있습니다.

</aside>

1. 들여쓰기 (Indentation)

2. 라인 길이 (Line Length)

3. 공백 (Whitespace)

4. 주석 (Comments)

5. 문서화 문자열 (Docstrings)

6. 함수와 변수명 (Naming Conventions)

7. 빈 줄 (Blank Lines)

8. 임포트 (Imports)

9. 코드 정렬 (Code Formatting)


🔹 PEP20 (The Zen of Python)

<aside> 💡

PEP20은 Python의 설계 철학을 설명하는 간결한 문서입니다. Pythonic한 코드를 작성하는 데 도움이 되는 철학적 가이드라인을 제시합니다.

</aside>

The Zen of Python, by Tim Peters

1. 아름다움은 중요하다 (Beautiful is better than ugly)

2. 명확함은 모호함보다 낫다 (Explicit is better than implicit)

3. 단순함은 복잡함보다 낫다 (Simple is better than complex)

4. 복잡함은 허용되지만, 지나치게 복잡한 코드는 피하라 (Complex is better than complicated)

5. 평범함은 특별함보다 낫다 (Flat is better than nested)

6. 읽기 좋은 코드는 작성하기 좋은 코드다 (Readability counts)

7. 일관성은 중요하다 (There should be one -- and preferably only one -- obvious way to do it)

8. 실용적인 이유가 없다면, 과거의 결정을 되돌리는 것은 피하라 (Special cases aren't special enough to break the rules)

9. 문제의 해결책은 간단하고 명확해야 한다 (Now is better than never)