[Python-Dev] hex constants, bit patterns, PEP 237 warnings and gettext

Guido van Rossum guido@python.org
Wed, 14 Aug 2002 09:11:44 -0400


>     TP> [Barry A. Warsaw]
>     >> ...  So if "0x950412de" isn't the right way to write a 32 bit
>     >> pattern,
> 
>     TP> It isn't today, but will be in 2.4.
> 
> But isn't that wasteful?  Today I have to add the L to my hex
> constants, but in a year from now, I can just turn around and remove
> them again.  What's the point?

Think 5 years rather than 1 year.

> The deeper question is: what's wrong with "0x950412de"?  What bits
> have I lost by writing my hex constant this way?  I'm trying to
> understand why hex constants > sys.maxint have to deprecated.

We're not deprecating them.  Instead, the type of hex constants
in range(sys.maxint, 2*sys.maxint+2) will change from int to long, to
be consistent with other hex constants.  Currently:

  >>> 0xf > 0
  True
  >>> 0xffff > 0
  True
  >>> 0xfffffff > 0
  True
  >>> 0xffffffff > 0
  False                      <----------- This anomaly will disappear
  >>> 0xfffffffff > 0
  True
  >>> 0xffffffffffffffff > 0
  True
  >>> 

--Guido van Rossum (home page: http://www.python.org/~guido/)