Message205713
@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. |
|
Date |
User |
Action |
Args |
2013-12-09 17:06:00 | tim.peters | set | recipients:
+ tim.peters, rhettinger, mark.dickinson, pitrou, vstinner, meador.inge, serhiy.storchaka, hct, anon |
2013-12-09 17:06:00 | tim.peters | set | messageid: <1386608760.94.0.252127676305.issue19915@psf.upfronthosting.co.za> |
2013-12-09 17:06:00 | tim.peters | link | issue19915 messages |
2013-12-09 17:06:00 | tim.peters | create | |
|