我希望我的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我遗漏了什么?
发布于 2019-05-10 00:48:27
我这样做了:
class MyModel(MongoModel):
fields = ...
def __init__(self, other_args...):
super(MyModel, self).__init__(other_args)
do_something_else()工作,但我得到了DeprecationWarning: __class__ not set defining...
Provide __classcell__ example for Python 3.6 metaclass在这里他们解释得更多,但我一点也不明白。
https://stackoverflow.com/questions/56045180
复制相似问题