`pathlib.PurePath.parents` is a sequence [1] but it rejects negative indexes:
>>> from pathlib import PurePath
>>> PurePath('a/b/c').parents[-2]
Traceback (most recent call last):
...
IndexError: -2
Sequences in Python interpret negative indexes as `len(seq) + i` [2]
I've included the patch that fixes the issue and adds corresponding tests. No documentation changes are needed.
[1]: http://docs.python.org/3/library/pathlib#pathlib.PurePath.parents
[2]: http://docs.python.org/3/library/stdtypes.html#sequence-types-list-tuple-range |