Python Forum
About integer objects vs integer values
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
About integer objects vs integer values
#1
Would it be more efficient to have integers represented by objects or values?
Eg if it's represented by an object,
Var = 5
Var points to an object which has the value '5'
Var = 5
Var is a location in memory representing '5'

When Var is reassigned, in object representation, a new object is created whereas if it was the value case then the memory location would just changed what value it stores

Why does Python use object representation for integers and strings)?
Is memory address value representation faster than object representation?
Reply


Messages In This Thread
About integer objects vs integer values - by Nwb - Apr-25-2019, 04:55 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Does the integer implementation matter? ichabod801 2 1,841 Oct-22-2019, 03:26 PM
Last Post: snippsat
  integer bases Skaperen 7 4,714 Nov-24-2017, 09:46 AM
Last Post: heiner55
  multiplying integer to decimal ArnabRoyBatman 8 12,668 Jun-20-2017, 04:49 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020