Does Python need a '>>>' operator?

Martin v. Loewis martin at v.loewis.de
Tue Apr 16 02:30:11 EDT 2002


bokr at oz.net (Bengt Richter) writes:

> >> I would guess so. I do. But for language purposes my preference is
> >> to refer to an abstract bit pattern, not hardware (even though
> >> hardware mappings will exist and be useful).
> >
> >That is only meaningful for positive numbers - it just doesn't work
> >for twos complement.
> >
> I works fine the way I'm thinking of it ;-) You must be looking at
> it differently, and I'm not sure what view it doesn't work for.
> My view is an abstraction where the sign bit is indefinitely duplicated
> to the left, but since they're all the same, you can think of them
> as represented by a single sign bit. 

That part works fine, I agree. However, neither the traditional hex
representation (strip of leading zeroes), nor the "logical shift"
operator >>> (insert zeroes when right-shifting) is meaningful using
this mental model. For the former, a negative number gets an infinite
hex representation, for the latter, it is impossible to tell how many
of the infinite number of one bits should be cleared in a logical
shift.

Regards,
Martin



More information about the Python-list mailing list