Hacker News new | past | comments | ask | show | jobs | submit login

I did some git archaeology. Here are relevant commits and bug reports:

* Initial commit with -1...99 cached:

https://github.com/python/cpython/commit/842d2ccdcd540399501...

* Cache more negative numbers, -5...99:

https://github.com/python/cpython/commit/c91ed400e053dc9f11d...

https://bugs.python.org/issue561244

* Cache more positive numbers, -5...256:

https://github.com/python/cpython/commit/418a1ef0895e826c65d...

https://bugs.python.org/issue1436243




good find! here's a summary:

it looks like they searched the standard library for negative integer literals and that's how they settled on -5 for the low end.

the high end came after introducing the `bytes` object. it went up to 256 instead of just 255 for size/len checks.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: