07/02/18 03:14:55
>>21 でおkかと思ったけど、len() ができないなぁ。
>>> l = wrapper([])
>>> len(l)
Traceback (most recent call last):
File "<pyshell#84>", line 1, in <module>
len(l)
TypeError: object of type 'wrapper' has no len()
TypeError なあたり、決まった型にしか呼べないのかも。
len(x) って内部で x.__len__ を返してるのかと思ってたけど、ちょっと違うのかな。
>>> l.append(3)
>>> l.__len__()
1