4 ms·
On the other hand, the first 256 integers are singletons in python, so they aren't duplicated.
by spott 7y ago
On the other hand, the first 256 integers are singletons in python, so they aren't duplicated.
- hermitdev 7y ago0-255 (inclusive) are singletons, just to clarify.
- mswtk 7y agoSlightly pedantic correction: This is a performance optimization in CPython. I wouldn't be surprised if other implementations have something similar, but to my best knowledge, this behaviour isn't part of the standard.
- merlincorey 7y ago> ... but to my best knowledge, this behaviour isn't part of the standard. To the best of my knowledge, Python isn't one such language with a standard, is it?
- ben509 7y agoThe standard is documented in PEPs[1]. CPython is the flagship implementation, and many PEPs discuss it directly, but if you're looking to write another Python, that's where you'd go. https://www.python.org/dev/peps/ https://www.python.org/dev/peps/