‘is’ operator behaves differently when comparing strings with spaces

Warning: this answer is about the implementation details of a specific python interpreter. comparing strings with is==bad idea. Well, at least for cpython3.4/2.7.3, the answer is “no, it is not the whitespace”. Not only the whitespace: Two string literals will share memory if they are either alphanumeric or reside on the same block (file, function, … Read more