gpt4 book ai didi

python - pycharm - 如何跟踪隐藏类方法 __get__

转载 作者:太空宇宙 更新时间:2023-11-04 00:15:58 24 4
gpt4 key购买 nike

class Foo():
def __init__(self):
self.bar_ref = self.bar # Allocation occurs here
self.x = 0.1

def bar(self, _):
self.x *= 1.2

@wim said

The dotted attribute access self.bar is an invocation of descriptor __get__, creating a bound method.

如何让 Pycharm 在调试时显示正在执行的 __get__

最佳答案

相关的__get__方法是用C实现的;这是func_descr_getObjects/funcobject.c 中。 PyCharm 不支持单步执行用 C 编写的代码。

我相信您可以使用 Python 调试构建和 Cython GDB extension 进入此代码,甚至使用 Python 调试构建和常规 GDB,如果您可以从原始的 C 级角度查看一切,但您不能在 PyCharm 中执行此操作。

关于python - pycharm - 如何跟踪隐藏类方法 __get__,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50974936/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com