Feature Requests item #1205239, was opened at 2005-05-19 19:54
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1205239&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: David Albert Torpey (dtorp)
Assigned to: Nobody/Anonymous (nobody)
Summary: Let shift operators take any integer value
Initial Comment:
Let:
1 >> -4
be interpreted as:
1 << 4
This should be easy to do. It would be somewhat helpful for
bit manipulations and multiplying by powers of two. Without
the change, my code is laced with sections like:
if y > 0:
z = x << y
else:
z = x >> -y
This is ugly and slow compared to a straight:
z = x << y
There is a precedent. See what is done with negative list
indices for comparison. It saves even less code with x[len
(x)-i] becoming x[i]. The reason for doing it is code
simplication and clarity.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1205239&group_id=5470
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com