Curious Omission In New-Style Formats
Random832
random832 at fastmail.com
Mon Jul 11 16:34:08 EDT 2016
On Mon, Jul 11, 2016, at 16:06, Michael Torrie wrote:
> I'm not sure I've ever seen a negative hex number in the wild. Usually
> when I view a number in hex I am wanting the raw representation. -0x123
> with a width of 7 would be 0xFFEDD
There's nothing "raw" about python int objects. To get what you want,
you need to do x & 0xfffff
If you have "5" as a parameter, you can get the desired constant as (1
<< x*4) - 1.
More information about the Python-list
mailing list