3 ms·
> It's not that hard to make non-allocating code in the first place It sure is in cpython. `a = 1` may need to allocate/reallocate the dict holding the local/g
by ben-schaaf 6y ago
> It's not that hard to make non-allocating code in the first place
It sure is in cpython. `a = 1` may need to allocate/reallocate the dict holding the local/global variables. If an integer exceeds 256 or goes below -5 you're getting an allocation for the object - regardless of whether that number has been seen before or not. Of course you can forget about floating point and function calls - maybe even function calls to C functions.