aspose file tools
The moose likes Jython/Python and the fly likes Python Caches Integer object in some range Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Languages » Jython/Python
Reply Bookmark "Python Caches Integer object in some range" Watch "Python Caches Integer object in some range" New topic
Author

Python Caches Integer object in some range

R. Jain
Ranch Hand

Joined: Aug 11, 2012
Posts: 276

Hello all,

In a book 'Core Python Programming' I read that Python caches simple integer objects between a range(-1, 100) which may change..
But this is not same for the float..

So there was an exammple like this: -


But when I ran this code in my Python interpreter, I got True value for both of them...

So, this mean my Python is caching both Integer and Float objects..
How is this happening??
Is this because of Version Difference?? I'm using Python 2.7..

OCPJP
 
I agree. Here's the link: http://zeroturnaround.com/jrebel
 
subject: Python Caches Integer object in some range
 
Similar Threads
JQplus
Q on Integer()
Precision of float and double
Boxing, ==, and Equals()
casting - from Dan's mock casting1