Does Python need a '>>>' operator?

Greg Ewing greg at cosc.canterbury.ac.nz
Mon Apr 15 22:03:12 EDT 2002


Bengt Richter wrote:
> 
> newhex(+7) => 0x7 # implied extension of msb => 0x000...007
> newhex(-7) => 0x9 # implied extension of msb => 0xfff...ff9

I think that would be very confusing. It's pretty
subtle that the MSB of the binary equivalent of the
first hex digit tells you whether the original number
was positive or negative.

If we were to have something like this, I would rather
see

  newhex(+7) => 0x07
  newhex(-7) => 0xF9

i.e. the leading hex digit is always either 0 or F.

Then I would also want an extra arg to hex() for
specifying how many digits I want.

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list