Does Python need a '>>>' operator?

Ken Peek Ken.Peek at SpiritSongDesigns.comNOSPAM
Sun Apr 14 23:44:47 EDT 2002


"David Eppstein" <eppstein at ics.uci.edu> wrote in message
news:eppstein-BBF667.20005414042002 at news.service.uci.edu:

| < snip! >
|
| >>> 0x40000000<<1
| -2147483648
|
| This is inconsistent with int-long unification.  In
| fact, I think it is a bug.  The answer should, of
| course, be 2147483648L, just as you would get by
| multiplying by 2 instead of shifting.
|
| < snip! >

Thanks Dave-- that IS what I was trying to say, but I wasn't
sure enough to use the "B.." word-- you do have a way with
words...

The other thing I was trying to say, is that if this _BUG_
(gee- that wasn't so hard!) in Python is fixed, then we need
a way to consistently do all of this bit shifting.  Now that
ints and longs are 'unified', you are supposed to be able to
write code that doesn't care what the internal
representation is-- that should also apply to the '<<' and
'>>' operators.  BUT, since we NOW don't know where the high
bit is (but the class that is managing the long object
DOES), we need a '>>>' operator to consistently handle a
logical right shift-- (i.e.: there is no way to code this
behavior in Python.)

So-- who wants to report this as a bug?  (I don't even know
how to do that...)






More information about the Python-list mailing list