Nick Papior <nickpap...@gmail.com> added the comment:

It basically checks that some part of the path is the same as some part of a 
reference path, they need not have the same complete parent which is why the 
resolve command would negate this comparison always.

------

As for your last example, that will be quite easily handled:

> would ``Path("dir/some.py").match(Path("*.py"))`` return?

str(Path("*.py")) == "*.py"

So no problems here.

It would even allow users for easier combination of patterns

suffix_path = Path("*.py")

if path.match("home" / suffix_path):
   <process this>
elif path.match("other" / suffix_path):
   <process this>


The equivalent code would have been:

suffix_path = "*.py"
if path.match(os.path.join("home", suffix_path):
   <process this>
elif path.match(os.path.join("other", suffix_path):
   <process this>


I think the former does not infer any confusion, nor does it seem to me to 
introduce anything that contradicts the meaning of match/glob/rglob.

----------

_______________________________________
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

Reply via email to