【发布时间】:2022-01-20 22:18:01
【问题描述】:
class FooBar:
attribute_map = {
"foo": "bar",
"bar": "foo"
}
def __init__(self):
setattr(self, "foo", "bar")
setattr(self, "bar", "foo")
foo_bar = FooBar()
print(foo_bar.foo)
print(foo_bar.bar)
我的代码看起来像这样。我希望 pycharm 使用属性映射来显示动态变量 foo 和 bar 的自动完成。这可能吗?
【问题讨论】: