Maxwell Ballenger <[email protected]> added the comment:
Use case: I want to see if a Path is a descendent of /tmp.
if filepath.parents[-2] == Path('tmp'):
turns into
if filepath.parents[len(filepath.parents)-2] == Path('tmp'):
----------
nosy: +maxballenger
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue21041>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com