【发布时间】:2020-10-15 15:08:52
【问题描述】:
object.__dict__ 和其他地方的隐藏方法设置如下:
<dictproxy {'__add__': <slot wrapper '__add__' of 'instance' objects>,
'__and__': <slot wrapper '__and__' of 'instance' objects>,
'__call__': <slot wrapper '__call__' of 'instance' objects>,
'__cmp__': <slot wrapper '__cmp__' of 'instance' objects>,
'__coerce__': <slot wrapper '__coerce__' of 'instance' objects>,
'__contains__': <slot wrapper '__contains__' of 'instance' objects>,
'__delattr__': <slot wrapper '__delattr__' of 'instance' objects>,
'__delitem__': <slot wrapper '__delitem__' of 'instance' objects>,
'__delslice__': <slot wrapper '__delslice__' of 'instance' objects>,
'__div__': <slot wrapper '__div__' of 'instance' objects>,
'__divmod__': <slot wrapper '__divmod__' of 'instance' objects>,
...
这些是什么,它们的用途是什么?
编辑: 这是来自:
class A:
pass
b = A()
print(type(b).__dict__)
【问题讨论】:
-
我认为您无效地缩短了表示。这是
mappingproxy({…})。对于正确的答案,这可能会有所不同。 -
谢谢。我看到的那个说
-
有一个答案here 可能会对此有所了解。
标签: python