This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ypank
Recipients akira, barry, ju-sh, maxballenger, mdk, pitrou, r.david.murray, serhiy.storchaka, thejcannon, victorg, ypank
Date 2020-08-10.07:25:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1597044309.46.0.58967223426.issue21041@roundup.psfhosted.org>
In-reply-to
Content
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('.')
History
Date User Action Args
2020-08-10 07:25:09ypanksetrecipients: + ypank, barry, pitrou, r.david.murray, akira, serhiy.storchaka, mdk, thejcannon, ju-sh, victorg, maxballenger
2020-08-10 07:25:09ypanksetmessageid: <1597044309.46.0.58967223426.issue21041@roundup.psfhosted.org>
2020-08-10 07:25:09ypanklinkissue21041 messages
2020-08-10 07:25:09ypankcreate