Replies: 1 comment 2 replies
-
I agree that the spec lacks precision in this regards but I think the spirit is to align with Python as per: Slices in JMESPath have the same semantics as python slices. If you're familiar with python slices, you're familiar with JMESPath slices. In Python slice indices are not clamped so that explains most of the behaviour that we see. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
See discussion in #102.
Behavior is currently undefined for out-of-bounds slice indices, e.g.
`[]`[10:]
and'foo'[-100:100]
. The former at least should probably align with Python and be valid but clamp indices, whereas the latter could either align with the former or raise exceptions (ideally making sense with whatever the decision is for out-of-bounds string index expressions such as'foo'[-1]
and'foo'[100]
, which are also currently undefined).Beta Was this translation helpful? Give feedback.
All reactions