Skip to content
Advertisement

Tag: string-interning

Does Python intern strings?

In Java, explicitly declared Strings are interned by the JVM, so that subsequent declarations of the same String results in two pointers to the same String instance, rather than two separate (but identical) Strings. For example: My question is, does CPython (or any other Python runtime) do the same thing for strings? For example, if I have some class: And

Advertisement