[Python-Dev] Negated hex/oct constants (SF #660455)

Delaney, Timothy C (Timothy) tdelaney@avaya.com
Thu, 6 Feb 2003 11:42:20 +1100


> From: Guido van Rossum [mailto:guido@python.org]
>=20
> It's quite unsettling:
>=20
>   >>> x =3D 0xffffffff
>   >>> x
>   -1
>   >>> -x
>   1
>   >>> -(0xffffffff)
>   1
>   >>> -0xffffffff=20
>   -4294967295L                          <<<<-------- !!!
>   >>>=20

This is my main concern - that there is an inconsistency between =
-(0xffffffff) and -0xffffffff.

I think whatever is decided, this inconsistency should be fixed for 2.3 =
(and possibly back-ported to 2.2).

So we end up with either

    0xffffffff =3D=3D -1
    -0xffffffff =3D=3D 1

or

    0xffffffff =3D=3D 4294967295L
    -0xffffffff =3D=3D -4294967295L

and 0xffffffff is going to stay as -1 until 2.4 ...

Tim Delaney