Nick Papior <nickpap...@gmail.com> added the comment:
Ok, I see this a feature. :) As for why it is desirable. A part of a path is still a path, and matching for something must mean that you are matching a partial path. Even if you use '*.py' as the pattern this would still make sense as a path: path = pl.Path("foo/bar") print(path.match("bar")) print(path.match(str(pl.Path("bar")))) print(path.match(str(pl.Path("*")))) The idea is that *anything* that can match a path _is_ a sub-path by definition, otherwise it can't be matched. So allowing path is just as natural as far as I see it. As for the above argumentation I think this also holds for Path.glob and Path.rglob where pattern could just as well be a Path. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45889> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com