Cache and reuse 1-length strings
CPython does this and seems like a good thing to do. Otherwise iterating over a string would cause lots of allocations. One difference between this implementation and cpython's is that cpython doesn't eagerly create them, and so it checks to see if they've been created or not.
Showing
Please register or sign in to comment