[Python-bugs-list] [ python-Bugs-471828 ] x<<n loses bits in 2.2.a4 (original) (raw)

noreply@sourceforge.net noreply@sourceforge.net
Tue, 16 Oct 2001 12:25:21 -0700


Bugs item #471828, was opened at 2001-10-16 12:25 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=105470&aid=471828&group_id=5470

Category: Python Interpreter Core Group: Python 2.2 Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: x<<n loses bits in 2.2.a4

Initial Comment: This change from pep-0237 has not made it to Python 2.2.a4. The pep says:

Currently, x<<n can lose bits for short ints.  This

will be changed to return a long int containing all the shifted-out bits, if returning a short int would lose bits.

Python still behaves as before:

Python 2.2a4 (#1, Oct 17 2001, 19:05:19) [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2 Type "help", "copyright", "credits" or "license" for more information.

1<<30 1073741824 1<<31 -2147483648 1<<32 0

The change would of course cause incompatibilities with existing programs relying on the old behaviour so I am not sure I want it very much myself. But just mentioning it, I suppose either the pep or Python needs updating.

Sverker Nilsson


You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=105470&aid=471828&group_id=5470