>>> class BOOL(bool):
... print "why?"
...
why?
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Error when calling the metaclass bases
type 'bool' is not an acceptable base type
我以爲Python信任程序員。爲什麼我不能在Python中擴展bool?
是否要添加FileNotFound值? – Juliano 2010-01-31 15:34:12
谷歌搜索或SO搜索「組合與繼承」在這裏可能很有用。 – MatrixFrog 2010-01-31 21:05:12