Are strings pooled in Python
Does Python have a pool of all strings and are they (strings) singletons there? More precise, in the following code one or two strings were created in memory: a = str(num) b = str(num) ? Strings are immutable in Python, so the implementation can decide whether to intern (that's a term often associated with C#, meaning that some strings are stored in a pool) strings or not. In your example, you're dynamically creating strings. CPython does not always look into the pool to detect whether the string is already there - it also doesn't make sense because you first have to reserve memory in order to