[issue21041] pathlib.PurePath.parents rejects negative indexes

Serhiy Storchaka report at bugs.python.org
Wed Jul 8 02:57:03 EDT 2020


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

Maxwell, in your case a more correct and obvious way is

    Path('/tmp') in filepath.parents

although it may be not very efficient. Using the is_relative_to() method may be more efficient and obvious.

----------
nosy: +serhiy.storchaka

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


More information about the Python-bugs-list mailing list