It may be useful to have a way to do an inclusive selection on a value range which follows the rule "keep all bins that overlap with the value range".
I think the clean way of introducing that is via a special slice-like object. I suggest value_range as a placeholder for a proper name. You would use it instead of slice inside __getitem__.
h[value_range(None, upper)] # selects all bins up to and including the bin containing upper
h[value_range(lower, None)] # selects all bins starting with the bin containing lower
h[value_range(lower, upper)] # selects all bins starting with the bin containing lower up to and including the bin container upper
bh.sum and bh.rebin and friends are supported as an optional third argument. value_range can be transformed internally into an ordinary slice.
It may be useful to have a way to do an inclusive selection on a value range which follows the rule "keep all bins that overlap with the value range".
I think the clean way of introducing that is via a special slice-like object. I suggest
value_rangeas a placeholder for a proper name. You would use it instead ofsliceinside__getitem__.bh.sumandbh.rebinand friends are supported as an optional third argument.value_rangecan be transformed internally into an ordinaryslice.