我想为我的PyMODM类定制一个初始值设定项。直截了当地做
class MyModel(MongoModel):
fields = ...
def __init__(self, other_args...):
super().__init__(other_args)
do_something_else()
首先生成警告:
DeprecationWarning: __class__ not set defining 'MyModel' as <class '__main__.MyModel'>. Was __classcell__ propagated to type.__new__?
然后是一个错误:
TypeError: __init__() missing required positional arguments
我错过了什么?你知道吗
我做到了:
工作,但我得到
DeprecationWarning: __class__ not set defining...
这里Provide __classcell__ example for Python 3.6 metaclass他们解释得更多,但我一点也不明白
相关问题 更多 >
编程相关推荐