Tomas Gustavsson <tompl...@gmail.com> added the comment:
Sorry Serhiy, missed your answer there. I understand your point. I guess I'll have to look for other things to help with :) Thank you for the answer. Guess this can be closed then. Best regards Tomas On Sat, 13 Feb 2021, 12:57 Serhiy Storchaka <rep...@bugs.python.org> wrote: > > Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment: > > 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. > > ---------- > nosy: +serhiy.storchaka > > _______________________________________ > Python tracker <rep...@bugs.python.org> > <https://bugs.python.org/issue43213> > _______________________________________ > ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43213> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com