提问人:Jim 提问时间:8/12/2023 更新时间:8/12/2023 访问量:27
在 Python CAPI 中,如果“__new__”不返回类或其实例,则不会调用“__init__”,它在哪里说?
Where does it says in the Python CAPI that if `__new__` does not return the class or an instance of it, `__init__` will not be called?
问:
在 Python 的文档中,据说如果类的方法既不返回类本身也不返回类的实例,则不会调用相应的方法。__new__
__init__
这在 Python C-API 中在哪里实现?
我已经搜索了 https://github.com/python/cpython/blob/main/Objects/typeobject.c#L3682 但找不到相关的实现。
答: 暂无答案
评论