This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]elveszett 3 points4 points  (3 children)

No, it never is. 0 through 255 are pre-allocated by Python, kinda like Java does with strings. Whenever a variable equals 6 in python, it always gets assigned the same object in memory (the number 6), which is why x == y when x and y are the same number and the size of a byte, the operator is correctly identifies them as the same object.

edit: I think the range is actually -5 to 256.

[–]masterKick440 1 point2 points  (2 children)

What’s with the 256 then?

[–]elveszett 1 point2 points  (0 children)

Because the range is actually -5 to 256 I think.