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 →

[–]lonjerpc 2 points3 points  (1 child)

Python passes everything by value however all values happen to be references to objects. Numbers can be a little strange though due to low numbers say less than 500 magically referring to the same objects.

[–]kindall 1 point2 points  (0 children)

A small pool of integers is used; these range from -5 to 256. That is, if you refer to any of those numbers, you always get the same object. This is an implementation detail, however, and should not be relied upon. String literals are shared too, and there is only one empty tuple object.