[issue33301] Add __contains__ to pathlib

Antoine Pitrou report at bugs.python.org
Tue Jun 19 15:00:48 EDT 2018


Antoine Pitrou <pitrou at free.fr> added the comment:

Not a good idea IMHO.  Why would containment mean the existence of a file in a directory?  It could just as well mean that a certain path component is part of the path.

Also I don't understand what would e.g. `Path('/usr/bar') in Path('/etc/foo')` mean.

As for adding a .exists method to PurePath, I think you're missing the point of PurePath here (i.e. its operations *don't* do any IO whatsoever).

----------
nosy: +pitrou

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


More information about the Python-bugs-list mailing list