Python 子类化:TypeError object.__new__() 不接受参数
好吧,我又遇到问题了!不过这应该很简单 ;-)
我想要创建一个新的类,这个类是基于pytables里的一个叫 tables.IsDefinition
的类,像这样:
import tables
class doc(tables.IsDescription):
def __init__(self, data):
self.data = data
然后当我尝试实例化这个类时,我收到了一个错误:
doc('test')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
...<ipython console> in <module>()
TypeError: object.__new__() takes no parameters
我使用的是Python 2.6.5(版本号:r265:79063,日期:2010年4月16日,时间:13:57:41)和IPython 0.10
我哪里做错了呢?