[Python-Dev] Re: Expectations of typing (was: The current state of typing PEPs)

2021年12月01日 22:48:46 -0800

I know this isn't really the place for this conversation, but:
> which is what `os.PathLike` represents, hence why `str` isn't covered by
> it);
>
wait, what? It seems so clear to me that "PathLike" (as a type specifier)
would mean: anything that can be passed into os.fspath to give me a path.
(or, of course to the stdlib functions that take paths)
Isn't the entire purpose of os.fspath that you can write code like:
def fun(some_kind_of_path):
 some_kind_of_path = os.fspath(some_kind_of_path)
 (or just pass it to a function you takes PathLIke)
and go on your merry way -- e.g. duck typing, baby!
Is there really no way to annotate that simply now?
-CHB
-- 
Christopher Barker, PhD (Chris)
Python Language Consulting
 - Teaching
 - Scientific Software Development
 - Desktop GUI and Web Development
 - wxPython, numpy, scipy, Cython
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/AYFULIM3SJ7DZK7SHGK436KGHX2M3WP5/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to