r/programming • • Nov 25 '15

Don't use the OWASP PHPSec Crypto Library

https://gist.github.com/paragonie-scott/91893fdb18ee4d1a1b95
37 Upvotes

80 comments sorted by

View all comments

Show parent comment

4

u/ajmarks Nov 26 '15

That's my point, is has enough corner cases where it "works"

Unless you're doing something fancy, is has exactly three corner cases: True, False, and None (because those are singletons).

1

u/[deleted] Nov 26 '15

If you are a new programmer and comparing ints with 'is', some weird stuff can occur. Not that 'is' should be used, but if someone uses it by mistake very weird things can happen.

x = 5
x is 5  # true
x = 826
x is 826  # false

http://stackoverflow.com/questions/306313/pythons-is-operator-behaves-unexpectedly-with-integers