Original: Department of Bo main article original article, reproduced and quoted, please indicate the source.
1. In Python, strings and integer objects are immutable ( the immutable) types, Python will cache them very efficiently.
2. Python2.3 simple integers buffer range (1,100), after at least Python2.5.4 range is simple integers cache (-5,256). All short characters (including single character) are also in the buffer zone.
3. tuple (tuple) is immutable, the tuple is not supported by a single cache.
[References]
- https://www.cnblogs.com/Presley-lpc/p/9129643.html
- https://blog.csdn.net/pro_leo/article/details/41786397