python 的对象内建方法:__XXX__(a1,a2)
文档:Customizing attribute access
The following methods can be defined to customize the meaning of attribute access (use of, assignment to, or deletion of x.name) for class instances.
在对该类对象做某种特定操作时,会触发相应方法的调用。
如 a+b=>__add__(b)
a[b] = 1=>__setitem__(1)
浙公网安备 33010602011771号