Tim Peters added the comment:

@pitrou, I think usability is a lot more valuable than cross-feature "formal 
consistency" here.  I've been extracting bit fields for decades, and always 
think of them in terms of "least-significant bit and number of bits".  Perhaps 
the underlying difference is that nobody ever thinks of bit positions as being 
_between_ bits - instead we always think of "bit i" as being the bit with 
binary value 2**i.  It's more of a math concept than an indexing concept.

For a bit _array_ I'd agree slicing semantics would make more sense.  But 
Python ints have infinite width, and "index 0" is at the rightmost position 
(not the leftmost position - there is no leftmost position).

I'd also like to avoid the nuisance of having to implement all the goofy 
slicing possibilities, like non-unit strides and negative strides.  Not that 
they're "goofy" in general - they're goofy in the context of extracting bits 
from an integer.  Again a bit array is a different kind of beast.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19915>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to