[issue33301] Add __contains__ to pathlib

Andrew Berger report at bugs.python.org
Tue Jun 19 19:34:13 EDT 2018


Andrew Berger <aberger91 at pm.me> added the comment:

I think the idea is that either a subdir or file could be valid inputs. 

So `Path('/usr/bar') in Path('/etc/foo')` return True if `Path('/etc/foo/usr/bar')` is either a dir or file.

As for PurePath, I did overlook that accessing an inode via a call to stat would be considered filesystem IO. So putting that method in Path (if this turns out to be a good idea) is the better option. Thanks

----------

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


More information about the Python-bugs-list mailing list