This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tomplast
Recipients tomplast
Date 2021-02-13.04:44:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1613191490.46.0.373267052174.issue43213@roundup.psfhosted.org>
In-reply-to
Content
While using pathlib I realised there are situations where I easily want to check if part of a returned path object contains a particular given path (as a string).

Today the following will give an error:
...
path = PosixPath('/usr/share/doc/')
if 'share' in path:
....print('Do something')

The patch will make the example above work and will open up for a simple shortcut.

This is my first attempt to contribute, all opinions are very welcome.

I have also pushed the commit to my own branch https://github.com/tomplast/cpython/tree/implement-path-contains.
History
Date User Action Args
2021-02-13 04:44:50tomplastsetrecipients: + tomplast
2021-02-13 04:44:50tomplastsetmessageid: <1613191490.46.0.373267052174.issue43213@roundup.psfhosted.org>
2021-02-13 04:44:50tomplastlinkissue43213 messages
2021-02-13 04:44:50tomplastcreate