Can we make 1 == 2 true?
Python int s are objects that encapsulate the actual number value. Can we mess with that value, for example setting the value of the object 1 to 2? So that 1 == 2 becomes True ?
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Python int s are objects that encapsulate the actual number value. Can we mess with that value, for example setting the value of the object 1 to 2? So that 1 == 2 becomes True ?
Asked · Jan 27
commented · Jan 28
Apparently list(a) doesn't overallocate, [x for x in a] overallocates at some points, and [*a] overallocates all the time ? Here are sizes n from 0 to 12 and the resulting sizes in bytes for the three methods: 0 56 56 56 1 64 88 88 2 72 88 96 3 80 88 104 4 88 88 112 5 96 120 120 6 104 120 128 7 112 120 136 8 120 120 152 9 128 184 184 10 136 184 192 11 144 18