Home
Sign Up
Sign In
推荐学习书目
›
Learn Python the Hard Way
Python Sites
›
PyPI
- Python Package Index
›
http://diveintopython.org/toc/index.html
›
Pocoo
值得关注的项目
›
PyPy
›
Celery
›
Jinja2
›
Read the Docs
›
gevent
›
pyenv
›
virtualenv
›
Stackless Python
›
Beautiful Soup
›
结巴中文分词
›
Green Unicorn
›
Sentry
›
Shovel
›
Pyflakes
›
pytest
Python 编程
›
pep8 Checker
Styles
›
PEP 8
›
Google Python Style Guide
›
Code Style from The Hitchhiker's Guide
V2EX
›
Python
关于在__getattribute__调用 getattr()的问题
sudo987
·
Jul 5, 2016
· 3278 views
This topic created in 3781 days ago, the information mentioned may be changed or developed.
刚才发了一篇帖子
http://v2ex.com/t/290512#reply1
,后来想想还是不对, getattr(self.__obj, attr)相当于 self.__obj.attr ,调用的是 self.__obj 本身的__getattribute__方法,跟外层__getattribute__没有关系,不解为什么会出现死循环。
getattr
调用
帖子
刚才
2 replies
•
2016-07-06 13:47:18 +08:00
perpyy
Jul 6, 2016
1
self.__obj 要不要调外层__getattribute__
kaneg
Jul 6, 2016
2
覆盖__getattr__而不是__getattribute__。
代码详情见原帖的回复。
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Privacy
·
Solana
·
3547 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 37ms ·
UTC 10:07
·
PVG 18:07
·
LAX 02:07
·
JFK 05:07
♥ Do have faith in what you're doing.
❯