Slightly 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.
The 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.
merlincorey|6 years ago
To the best of my knowledge, Python isn't one such language with a standard, is it?
ben509|6 years ago
https://www.python.org/dev/peps/