Does Python need a '>>>' operator?
Tim Peters
tim.one at comcast.net
Mon Apr 15 21:03:45 EDT 2002
[Bengt Richter]
> ...
> I just think the signed hex is not terribly useful.
In practice, if I'm working with 300-bit bitsets represented as longs, I
never do hex(x), but hex(x & mask) instead, where mask = ~(-1L << 300) (a
string of 300 low-order bits). Regardless of x's sign, that "shows the
bits" in a 1-means-on 0-means-off sense. The key is that I *know* the width
I have in mind, much as hex(int) knows the width of a platform C long today,
so can pull the same trick for regular ints.
More information about the Python-list
mailing list