Does Python need a '>>>' operator?

Martin v. Loewis martin at v.loewis.de
Mon Apr 15 02:20:52 EDT 2002


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

> When "hex(x)" creates a string from a long, it should not have a '-'
> sign if the long is negative, but rather should print out the
> hexadecimal representation of the number in using the number of
> bytes that the object currently occupies.

That can't possibly work. That way, hex(-1L) would be "1", or perhaps
"0001" (since it will use 2 bytes to represent the value). This is
indistinguishable from hex(1L) - something that is clearly
undesirable.

> If we are printing a long as a decimal number, then we DO add the
> '-' sign.

So why should hexadecimal be different? It is just the base-16
representation of the number, nothing more.

Regards,
Martin



More information about the Python-list mailing list