Yaroslav Pankovych <flower.m...@gmail.com> added the comment:

That's kinda weird for python. I mean, in regular list/etc if I need the last 
element, I'd normally do list[-1], but here to get the last parent, I need to 
actually know how many parents do I have.

So now, I can do something like this:

>>> parents_count = len(path.parents) - 1
>>> path.parents[parents_count]
PosixPath('.')

----------
message_count: 16.0 -> 17.0
nosy: +ypank
nosy_count: 10.0 -> 11.0
pull_requests: +20938
stage:  -> patch review
versions: +Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.9
pull_request: https://github.com/python/cpython/pull/21799

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue21041>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to