Does Python need a '>>>' operator?
David Eppstein
eppstein at ics.uci.edu
Mon Apr 15 02:56:09 EDT 2002
In article <m38z7pmq4p.fsf at mira.informatik.hu-berlin.de>,
martin at v.loewis.de (Martin v. Loewis) wrote:
> Indeed, if you write
>
> >>> 0x40000000L<<1
> 2147483648L
>
> it works the way you expect it to work. Please see
>
> http://www.python.org/peps/pep-0237.html
>
> Python has currently completed phase A of the PEP, meaning that
> operations that previously raised an OverflowError now return a long;
> nothing else has changed.
>
> Notice that your example is the historic meaning of shift; in phase
> B.1, it will change to the arithmetic meaning (multiplication with
> 2). Since this is a semantic change, you'll get a warning if you make
> use of a short int shift that loses a bit.
Thanks. I notice the PEP doesn't actually say anything about signs,
though, it just talks about losing bits, so I hope this example is
covered.
Is there some way of getting the arithmetic meaning now, without a
warning, using a __future__ import?
--
David Eppstein UC Irvine Dept. of Information & Computer Science
eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/
More information about the Python-list
mailing list