Adding type annotations for fspath

1 · Guido van Rossum · May 18, 2016, 2:06 p.m.
Type annotations for fspathPython 3.6 will have a new dunder protocol, __fspath__() , which should be supported by classes that represent filesystem paths. Example of such classes are the pathlib.Path family and os.DirEntry  (returned by os.scandir() ).You can read more about this protocol in the brand new PEP 519. In this blog post I’m going to discuss how we would add type annotations for these additions to the standard library.I’m making frequent use of AnyStr , a quite magical type variable ...