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
问一个 Python 3.4 closure 的问题
Ultratude
·
Jun 20, 2015
· 5187 views
This topic created in 4157 days ago, the information mentioned may be changed or developed.
有一项目 Python 2.7 的 code 类似这样,现在想要兼容 3.4。
https://gist.github.com/ultratude/c43a89d1ce03220d6a0c
显示 Gist 代码
Python 3.4 下会报错,搜了很久没有很好的答案。
求教,谢谢。
Python
Closure
求教
7 replies
•
2015-06-20 23:44:35 +08:00
Ultratude
OP
Jun 20, 2015
1
主帖里贴两条 gist,会显示同一条两遍,貌似是 bug。
所以错误贴在这里。
https://gist.github.com/ultratude/29bb8021a3ac4f1153da
Valyrian
Jun 20, 2015
1
2
这。。感觉是应该能正常运行的code
Ultratude
OP
Jun 20, 2015
3
@
Valyrian
是啊,我也觉得没问题,十分蛋疼。
kcworms
Jun 20, 2015
1
4
原因在
https://www.python.org/dev/peps/pep-3110/
可以尝试:把异常实例里要用的内容拷贝一下,之后再也不要引用了
killpanda
Jun 20, 2015
1
5
可以这样吧:
https://gist.github.com/killpanda/3539b9e02270050469c7
Ultratude
OP
Jun 20, 2015
6
@
killpanda
@
kcworms
非常感谢!
isaaczeng
Jun 20, 2015
7
https://gist.github.com/gfZeng/103ae58a8301a64e27b8
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Privacy
·
Solana
·
1916 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 47ms ·
UTC 15:30
·
PVG 23:30
·
LAX 07:30
·
JFK 10:30
♥ Do have faith in what you're doing.
❯