[-] sesenion@mastodon.social 1 points 3 weeks ago

@EveryMuffinIsNowEncrypted
Careful about "is" and "is not"
These compare identity of objects, which in CPython usually checks if objects are at the same memory address.

This works for some objects like True, False, None and small integer numbers, since they are created as unique objects when the interpreter starts.

Usually you would use == or != for these types of comparison. See below an example where "is" fails comparing two identical float numbers.

sesenion

joined 2 years ago