[issue19915] int.bit_at(n) - Accessing a single bit in O(1)

Tim Peters report at bugs.python.org
Mon Dec 9 04:29:44 CET 2013


Tim Peters added the comment:

@serhiy, Mark certainly knows the proposed addition isn't _needed_ to pick apart 64-bit integers.  It's an issue there of clarity, not O() behavior.  For example, `i.bits_at(0, 52)` to get at a double's mantissa requires no thought at all to write or to read later; bit-level gibberish like

i & ~((~0) << 52)

or

i & ((1 << 52) - 1)

or ... is painful to write and to read.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19915>
_______________________________________


More information about the Python-bugs-list mailing list