Jon Paris
2015-08-21 18:04:18 UTC
This code:
import sys
x = sys.maxsize
print ("Max size is: ", x)
y = (x + 1)
print ("y is", type(y), "with a value of", y)
Produces this result:
Max size is: 9223372036854775807
y is <class 'int'> with a value of 9223372036854775808
I was expecting it to error out but instead it produces a value greeter than the supposed maximum while still keeping it as an int. I’m confused. If sys.maxsize _isn’t_ the largest possible value then how do I determine what is?
Jon Paris
***@gmail.com
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
import sys
x = sys.maxsize
print ("Max size is: ", x)
y = (x + 1)
print ("y is", type(y), "with a value of", y)
Produces this result:
Max size is: 9223372036854775807
y is <class 'int'> with a value of 9223372036854775808
I was expecting it to error out but instead it produces a value greeter than the supposed maximum while still keeping it as an int. I’m confused. If sys.maxsize _isn’t_ the largest possible value then how do I determine what is?
Jon Paris
***@gmail.com
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor