ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • The Zen of Python
    Programming Language/Python 2024. 4. 2. 23:12

    The Zen of Python은 Python의 선구자 Tim Peters가 Python을 설계할 때 내세운 원칙이라 한다. 여기서 zen은 불교적 의미로 '선()'을 의미한다. 그 의미를 찾아보니 '삼문(三門)의 하나. 마음을 가다듬고 정신을 통일하여 무아정적(無我靜寂)의 경지에 몰입하는 일'이라고 한다. 여기서 무아정적의 뜻을 살펴보니 무아(無我)는 '만물에는 고정 불변하는 실체로서의 나〔實我〕가 없다'는 뜻이고 정적(靜寂)은 '고요하고 쓸쓸함'이라는 뜻이다. 불교의 무아를 찾아보면 좋을 것이다.

     

    20개의 구절이 있었으나 현재는 19개 구절만이 기록돼 남아 있다고 한다.

    Beautiful is better than ugly.
    Explicit is better than implicit.
    Simple is better than complex.
    Complex is better than complicated.
    Flat is better than nested.
    Sparse is better than dense.
    Readability counts.
    Special cases aren't special enough to break the rules.
    Although practicality beats purity.
    Errors should never pass silently.
    Unless explicitly silenced.
    In the face of ambiguity, refuse the temptation to guess.
    There should be one-- and preferably only one --obvious way to do it.
    Although that way may not be obvious at first unless you're Dutch.
    Now is better than never.
    Although never is often better than *right* now.
    If the implementation is hard to explain, it's a bad idea.
    If the implementation is easy to explain, it may be a good idea.
    Namespaces are one honking great idea -- let's do more of those!

     

    import this

    위 코드를 실행시키면 The Zen of Python이 출력된다.

    'Programming Language > Python' 카테고리의 다른 글

    Closure, First Class Object  (0) 2024.04.11
    Nested function, Nonlocal, Global  (0) 2024.04.02
    Docstring  (0) 2023.12.14
    Boolean 더하기  (0) 2023.10.15
    string 함수 split(), split(' ') 차이점  (1) 2023.10.13
Designed by Tistory.