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
Python3的long实现问题
Sherlockhlt
·
Mar 27, 2013
· 5886 views
This topic created in 4991 days ago, the information mentioned may be changed or developed.
两个问题,困惑了我好久:
1. Python3中是不是把int都改成long,然后对外申称都是int了?
2. Python3中是不是long都改成不缓存了?在longobject.c里面没有看到对象缓存(free list)的代码。
Long
Python3
int
4 replies
•
1970-01-01 08:00:00 +08:00
timonwong
Mar 27, 2013
1
1. 嗯,统一为int,就是Python 2.x的long
2. 有的:
int
_PyLong_Init(void)
{
#if NSMALLNEGINTS + NSMALLPOSINTS > 0 // 从这里开始分配
...... 一段代码
#endif // 这里结束
/* initialize int_info */
Sherlockhlt
OP
Mar 27, 2013
2
@
timonwong
这一段是存放小整数的,只存放[-5,257)
在2.6.x中,大整数是用自由链表来缓存的,但是在3.0找了很久都找不到。。
timonwong
Mar 27, 2013
3
@
Sherlockhlt
刚才理解错了,确实没有freelist了
这里有相关的issue
http://bugs.python.org/issue2013
Sherlockhlt
OP
Mar 27, 2013
4
@
timonwong
哦,原来他们觉得优化不够明显就删掉了。。3.0改动真多阿
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Privacy
·
Solana
·
4289 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 31ms ·
UTC 07:25
·
PVG 15:25
·
LAX 23:25
·
JFK 02:25
♥ Do have faith in what you're doing.
❯