Apr-25-2019, 04:55 AM
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?
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?