[issue33301] Add __contains__ to pathlib
Andrew Berger added the comment: I can make these changes. Would probably add a .exists method to PurePath, using the _normal_accessor.stats staticmethod, then call that in __contains__ -- nosy: +aberger5b ___ Python tracker <https://bugs.python.org/issue33301> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33301] Add __contains__ to pathlib
Andrew Berger 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 <https://bugs.python.org/issue33301> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com