Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Python Caches Integer object in some range  RSS feed

R. Jain
Ranch Hand
Posts: 375
Java Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!