<div dir="ltr"><div>In typeshed there is os.PathLike which is close. You should be able to use Union[str, os.PathLike[str]] for what you want (or define an alias).</div><div><br></div><div>We generally don't want to add more things to typing that aren't closely related to the type system. (Adding the io and re classes was already less than ideal, and we don't want to do more of those.)<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 8, 2018 at 3:10 PM <<a href="mailto:robert.hoelzl@posteo.de">robert.hoelzl@posteo.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
Since __fspath__ was introduced in PEP 519 it is possible to create <br>
object classes that are representing file system paths.<br>
But there is no corresponding type object in the "typing" module. Thus I <br>
cannot specify functions, that accept any kind of object which supports <br>
the __fspath__ protocol.<br>
<br>
Please note that "Path" is not a replacement for "SupportsFsPath", since <br>
the concept of PEP 519 is, that I could implement new objects (without <br>
dependency to "Path")<br>
that are implementing the __fspath__ protocol.<br>
<br>
robert<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>