Loading

python __getattr__ __getattribute__

我们以a.x为例,对象a调用属性x。

  • 无论a 是否有属性 x 都会调用 __getattribute__
  • 仅仅在 a 没有属性 x 时,才会调用 __getattr__

参考:
https://stackoverflow.com/questions/4295678/understanding-the-difference-between-getattr-and-getattribute

posted @ 2022-04-10 21:03  lif323  阅读(32)  评论(0)    收藏  举报