- comparisons.py
- comparisons.py
3.3.2. Comparisons¶
This page contains a memo on comparisons.
from Tools import *
Let define some strings
s0 = 'abc'
s1 = 'def'
Let define a reference or alias to s0
s2 = s0
s0
and s2
have the same id, address of the object in memory.
pretty_print([id(x) for x in (s0, s2, s1)])
[ 139877472330784,
139877472330784,
139877471407664]
print(id(s0) == id(s2))
True