+ 1
Is (not exprassion) aqual to (var1 != var2)
2 ответов
+ 3
a is not b
a != b
Both mean different things. The first asks Python, does "a" not have the same reference id as "b". This compares reference id's with frames/heaps. If you aren't sure what those are, either don't use it, or read more about it. Or ask separately here on a new topic.
The second asks Python, does "a" not have the same value as "b". This is sort of self explanatory, as it's asking if 2.0 equals 2. Or if it's strings, is the string the same as the other string? "==" compares the values "a" and "b", where as "is" compares reference id's.
If this isn't what you meant, please be more specific.
0
@sapphire thank u