【发布时间】:2021-08-03 19:41:07
【问题描述】:
我定义了一个包含几个字段的数据类。当我打印它时,它们以正确的顺序显示:
def test():
@dataclass
class Image:
width: int
height: int
pixels: object
image = Image(width=4, height=3, pixels=list(range(12)))
print(image)
pass
这段代码的输出不错:
test.<locals>.Image(width=4, height=3, pixels=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
但是,如果我检查 PyCharm 中的变量(通过在最后一行的断点处停止,即 pass),它会按字母顺序显示字段,这很令人困惑:
我可以解决这个问题吗?
我正在使用 PyCharm 2019.1.2。
【问题讨论】:
标签: python debugging pycharm watch