Does Python need a '>>>' operator?

Ken Peek Ken.Peek at SpiritSongDesigns.comNOSPAM
Mon Apr 15 03:06:34 EDT 2002


"Martin v. Loewis" <martin at v.loewis.de> wrote in message
news:m34ridmq00.fsf at mira.informatik.hu-berlin.de...

| That's what I'm trying to tell you all the time: the
| '>>>' operator is meaningless if it is defined as
| "fill in zeroes". How does it know where to start
| inserting zeroes?

No, it isn't meaningless:

The 'long' class has an internal representation for the
long number.  The number of bytes that are currently
being used to contain the number are known (internally)
to the object.  The zeroes get shifted into the high bit
of the number, no matter how many bytes are used to
contain the number.

An int type simply shifts a zero into bit 31, so that
this works the same as it will on a long.

The '>>' operator should also work the same for a long
as it does for an int.

The '<<' operator should also work the same for a long
as it does for an int.

The 'hex()' method should work the same for a long as
it does for and int.

Why is this so confusing to you?  Java programmers have
been putting the difference between the '>>' and the
'>>>' operators to good use for years!






More information about the Python-list mailing list