jeroeningelbrecht

View on GitHub
created at: 9 August 2019
[home]

string

by jeroen

String

String interning

Comparable to Java, and according to wikipedia:

string interning is a method of storing only one copy of each distinct string value … The distinct values are stored in a string intern pool

s1 = 'hello world'
s2 = 'hello world'
# are both variables s1 and s2 pointing to the same string object?
print(s1 is s2) #True
[home]
tags: [python] [string]