calendarcodediamondfacebookfingerglobalgoogleplushatenahomepagetopplainpocketrssservicetwitterwordpresshome2searchfoldernext-arrowback-arrowfirst-arrowlast-arrow

特殊メソッド
特殊メソッドとは、Pythonが暗黙的に呼び出すメソッドである。

Python : __iter__()はイテレータを返し、__next__()は次の要素を返す

Pythonにおけるイテレータとはなんだろう?イテレータオブジェクト(list、tuple、set など)は内部にイテレータを持ち、

Python : __call__()は、インスタンスを関数のように扱う

特殊メソッドである__call__はインスタンスを関数オブジェクトとして扱う。__call__を実装したクラスでは、インスタンスを関

Python : __str__() と __repr__() は、オブジェクトを文字列で表現する

__str__()と__repr__()は、どちらもオブジェクトの文字列表現を返す特殊メソッドである。 __str__()