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

标签 python pycharm

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/

相关文章:

git - 如何在 merge 操作中恢复某个特定文件的 'Resolve Conflict'?

java - 如何从 Java 调用 scikit-learn 分类器?

Python MySQLdb : Iterating over a cursor

CSS 中的 Python 变量

python - 保存在 python 中使用 peek() 显示的图像

python - 如何从 AzureML 中的训练脚本访问工作区对象?

python - 导入错误 : No module named 'nltk.tokenize' ; 'nltk' is not a package

python - 无法在 PyCharm 中导入 tensorflow

html - CSS 在我的 Python/HTML 元素中不起作用

python - 无法在pycharm中安装mysql-connector-python