Does Python need a '>>>' operator?

Martin v. Loewis martin at v.loewis.de
Mon Apr 15 02:38:36 EDT 2002


"Ken Peek" <Ken.Peek at SpiritSongDesigns.comNOSPAM> writes:

> You may be right that I am getting confused about the hex
> display of longs-- That's because the display of a hex
> number with a '-' sign prepended is such a ridiculous
> notion

The display of numbers in the decimal system with a sign is such a
ridiculous notion...

Please remember what a positional system is; if B is the base, then
abcde means

   e + d*B + c*B**2 + b*B**3 + a*b**4

and -abcd means

   -e - d*B - c*B**2 - b*B**3 - a*b**4

I don't find this ridiculous, whether B is 10 or 16.

> There is another _BUG_ in Python:
> 
> >>> 0x40000000 << 1
> -2147483648
> 
> This should have been automatically converted to a long, not
> a negative int.

This is by design; read PEP 237.

> If we _ARE_ going to unify the long and int types, then
> let's bite the bullet, and DO IT RIGHT.  

In phase B.1, it will be right.

Regards,
Martin



More information about the Python-list mailing list