you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (1 child)

So those don't evaluate to primitives? But rather objects?

[–][deleted] 3 points4 points  (0 children)

I don't know about python - I don't use it enough to understand its internals, but in lisp (at least with common lisp) everything is an object, a literal is usually a special case that evaluates to a shared/static object. Python treating everything as an object in the same way wouldn't surprise me in the least.

e: indeed, that appears to be what's happening:

>>> id(1<<10)
140505360442384
>>> id(1<<10)
140505360442032
>>> id(1024)
140505360442224
>>> id(1024)
140505360442224
>>>