Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API

From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I never even thought about trying to use the "is" operator with numbers. I also will never become a pentester.
-
Hazarth93855yIn python (and many other languages including java)
Often used values are pooled. For example numbers up to 256 are pooled in python.
That means that all numbers up to 256 will have a single place in memory
a = 256
a is 256 results in True
But a = 257
a is 257 will be False
The idea is to save time and space for values that appear commonly in code
This is normal behaviour and also why you should be using == instead of reference comparison (is)
Related Rants
Python.. I seriously thought we understood each other but I guess it's all over now.💔
random
python