Updated:

1 minute read

Python?

  • 플랫폼 독립적, 인터프리터, 객체지향, 동적 타이핑 대화형 언어


역사

  • 1991년
    • 귀도 반 로섬이 발표
  • 2000년 10월 16일
    • Python 2.0 발표
  • 2008년 12월 3일
    • Python 3.0 발표
    • Python 2.x과 하위 호환성 없음


특징

  • 문법이 엄격
  • 순수 객체 지향
    • 모든 것을 객체로 취급
    • x=3, y=3일 때 x와 y의 주소 값이 동일


The Zen of Python

  • 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!
    • 네임스페이스는 훌륭한 아이디어 중 하나이므로 자주 사용하자.


Hello, World!

  • 코드
     if __name__ == "__main__":
         print("Hello, World!")
    
  • 실행 결과
     Hello, World!