[Python-Dev] Drop support for ones' complement machines?

James Y Knight foom at fuhm.net
Tue Dec 1 17:17:00 CET 2009


On Dec 1, 2009, at 11:08 AM, Martin v. Löwis wrote:

>>> I'd rather prefer to explicitly list what CPython assumes about the
>>> outcome of specific operations. If this is just about &, |, ^, and ~,
>>> then its fine with me.
>> 
>> I'm not even interested in going this far:
> 
> I still am: with your list of assumptions, it is unclear (to me, at
> least) what the consequences are. So I'd rather see an explicit list
> of consequences, instead of buying a pig in a poke.

I think all that needs to be defined is that conversion from unsigned to signed, and (negative) signed to unsigned integers have 2's complement wrapping semantics, and does not affect the bit pattern in memory.

Stating it that way makes it clearer that all you're assuming is the operation of the cast operators, and it seems to me that it implies the other requirements.

James


More information about the Python-Dev mailing list