[issue21041] pathlib.PurePath.parents rejects negative indexes

Yaroslav Pankovych report at bugs.python.org
Sat Nov 21 09:10:23 EST 2020


Yaroslav Pankovych <flower.moor at gmail.com> added the comment:

That makes sense, but should we have this behaviour only for negative indices? 

We'll end up with something lie:

path.parents[len(path.parents) - 1] != path.parents[-1]

I think that is should be consistent regardless of negative/positive indices.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue21041>
_______________________________________


More information about the Python-bugs-list mailing list