class Foo():
def __init__(self):
self.bar_ref = self.bar # Allocation occurs here
self.x = 0.1
def bar(self, _):
self.x *= 1.2
The dotted attribute access
self.bar
is an invocation of descriptor__get__
, creating a bound method.
如何让 Pycharm 在调试时显示 __get__
正在执行?
最佳答案
相关的__get__
方法是用C实现的;这是func_descr_get
在Objects/funcobject.c
中。 PyCharm 不支持单步执行用 C 编写的代码。
我相信您可以使用 Python 调试版本和 Cython GDB extension 进入此代码。 ,或者甚至使用 Python 调试构建和常规 GDB(如果您可以从原始 C 级角度查看一切),但您无法在 PyCharm 中做到这一点。
关于python - pycharm-如何跟踪隐藏类方法 __get__,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50974936/