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

anon report at bugs.python.org
Thu Oct 2 08:55:11 CEST 2014


anon added the comment:

Above I included a first attempt however I don't think my code is good and I couldn't figure out the case for negative integers. There's some discussion above about its inclusion.

I like your x.bits suggestion actually, assuming x.bits returns an IntBitsView object without copying x in any way. That would suggest that we could do len(x.bits) and probably depreciate x.bit_length(). Any consensus on this?

----------

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


More information about the Python-bugs-list mailing list