Re:Python behind the scenes #8: how Python integers work
by pansa2 on Tuesday February 09, 2021 @06:11PM
(#26083775)
Guido has been strongly opposed to the use of tagged integers:
https://mail.python.org/pipermail/python-dev/2004-July/04614...
Re:Python behind the scenes #8: how Python integers work
by woadwarrior01 on Wednesday February 10, 2021 @06:34AM
(#26087934)
IMO, that excuse doesn't hold water on 64 bit machines. On 64 bit machines, not using tagged pointers (using the CPU for fast arithmetic on word sized integers) and instead using the slow branchy sign-magnitude representation that cPython uses for integers is unconscionable, in terms of both performance and memory usage.
Re:Python behind the scenes #8: how Python integers work
by rtpg on Tuesday February 09, 2021 @08:00PM
(#26084625)
this is a post from 16 years ago, and there might be someone who comes around with a solution that resolves his concerns (granted, I feel like it would be hard to come up with a great solution in a language like C, having some ubiquitous unwrapping mechanism + better type checking would make this doable though....)
Re:Python behind the scenes #8: how Python integers work
by pansa2 on Tuesday February 09, 2021 @08:20PM
(#26084761)
> this is a post from 16 years ago
Sure, but the only opportunity to change this was along with the other breaking changes in Python 3.0, which is now 12 years old.
Re:Python behind the scenes #8: how Python integers work
by KMag on Wednesday February 10, 2021 @01:35AM
(#26086235)
It might still be possible to change, by changing the macros that unwrap integers to support tagged integers, then waiting a decade or two before actually starting to use tagged integers. Things that hadn't been recompiled in a decade or two, but were for some reason running the latest interpreter would break. Presumably the number of breakages would be negligible.
Re:Python behind the scenes #8: how Python integers work
by kevin_thibedeau on Tuesday February 09, 2021 @08:51PM
(#26084949)
This isn't portable C. You can't assume that some pointers will be invalid and free for other uses.
Re:Python behind the scenes #8: how Python integers work
by jashmatthews on Wednesday February 10, 2021 @05:17AM
(#26087442)
The runtime also controls the alignment of allocations.
I think the only reason not to have that is maintaining c-python compatibility, but it would have been nice if they could have moved to it for the 3.0 break.