Value equality vs identity
- Value –> equivalent
contents
- Identity –> same object
Binding Names to Objects
p = [1,2,3]
q = [1,2,3]
p == q # --> True --> val is same
p is q # --> False --> not same obj
a = "first"
b = "first"
a is b # --> True
- NOTE:
- Immutable object (str, int tuple)
refers to same obj if values are same
- Mutable obj always create new object
- Immutable object (str, int tuple)
Pass by object reference
- Python uses neither
Pass by Value
norPass by Reference
- But it uses
Pass by Object Reference