関数オブジェクトについて
>>> import twitter >>> twitter.Api() <twitter.Api object at 0xb7d1bbec> >>> a = _ >>> b = twitter.Api() >>> a == b False >>> a.GetUser <bound method Api.GetUser of <twitter.Api object at 0xb7d1bbec>> >>> c = _ >>> d = b.GetUser >>> d <bound method Api.GetUser of <twitter.Api object at 0xb7d1be8c>> >>> e = a.GetUser >>> e <bound method Api.GetUser of <twitter.Api object at 0xb7d1bbec>> >>> c == e True >>> c == d False
同じオブジェクトから取得した関数は同じ関数だけど
違うオブジェクトから取得した関数は別物みたい
>>> f = twitter.Api.GetUser
>>> f
<unbound method Api.GetUser>
>>> g = twitter.Api.GetUser
>>> g
<unbound method Api.GetUser>
>>> f == g
True
クラスメソッド自体は毎回おなじのが返ってくる。
オブジェクトが状態を持つからある意味あたりまえといえば当たり前かぁ