Last active
February 18, 2019 01:51
-
-
Save yatakeke/57894c8cfd9b8af223facb45e3d356af to your computer and use it in GitHub Desktop.
Pythonの特殊メソッドについて
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def __str__(self) | |
# printやformat文の引数としてオブジェクトが指定された時に | |
# 呼び出され、非公式の文字列表現を返す。 | |
def __call__() | |
# classを直接呼び出す時に実行される。 | |
def __repr__() | |
# 正式なオブジェクトの内容を文字列で返し、 | |
# インタプリターが同値性をチェックする時に使われる。 | |
def __eq__(other) | |
# Object == other の時に呼び出される。 | |
def __hash__() | |
# ハッシュを使ったコレクションの操作から呼び出される。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment