+ 1
Why it is false???
a=[] b=[] print(a is b )
5 Answers
+ 5
I was gonna type an answer but I found this:
https://stackoverflow.com/questions/13650293/understanding-pythons-is-operator
+ 5
is asks if they reference the same object
+ 3
a=[]
b=a
print(b is a) #True
because their b depend on a and we can say b is child and a is parents of b,so they has same D.N.A,so b is a True.
a=[]
b=[]
print(a is b) #False
because their b does not depend on a and we can say b is parents and a is also another parents,so they has not same D.N.A, so b is a False.
+ 2
Omar o you need to watch this video.
https://youtu.be/CZ8bZPqtwU0
0
Maninder Singh
but when i say
a=1
c=1
a is c
true
although a isnot parents of c??