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 serhiy.storchaka
Recipients serhiy.storchaka, tomplast, veky
Date 2021-02-13.11:56:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1613217407.1.0.177645417195.issue43213@roundup.psfhosted.org>
In-reply-to
Content
Path is not string, and it was made not string-like intentionally. Otherwise it would be made a subclass of str.

If you want to check whether a string is a substring of the string representation of the path, just do it explicitly: 'share' in str(path). But in most cases it is not what the user intended.

There were several propositions about implementing "in" (and iteration, these operations are related and should be consistent). The problem is that there several different meaning of that operation. Should it check that the directory referred by the path contains the specified file name? Or that the path contains the specified path component? Or that one path is a subpath of other path? Or that the specified string is a substring of the string representation of the path? (The latter proposition is the least useful.) It is better to avoid ambiguity, so all these proposition were rejected.
History
Date User Action Args
2021-02-13 11:56:47serhiy.storchakasetrecipients: + serhiy.storchaka, veky, tomplast
2021-02-13 11:56:47serhiy.storchakasetmessageid: <1613217407.1.0.177645417195.issue43213@roundup.psfhosted.org>
2021-02-13 11:56:47serhiy.storchakalinkissue43213 messages
2021-02-13 11:56:47serhiy.storchakacreate