[Python-Dev] Defining a path protocol

Donald Stufft donald at stufft.io
Thu Apr 7 07:03:56 EDT 2016


> On Apr 7, 2016, at 6:48 AM, Nikolaus Rath <Nikolaus at rath.org> wrote:
> 
> Does anyone anticipate any classes other than those from pathlib to come
> with such a method?


It seems like it would be reasonable for pathlib.Path to call fspath on the
path passed to pathlib.Path.__init__, which would mean that if other libraries
implemented __fspath__ then you could pass their path objects to pathlib and
it would just work (and similarly, if they also called fspath it would enable
interoperation between all of the various path libraries).

-----------------
Donald Stufft
PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.python.org/pipermail/python-dev/attachments/20160407/32899beb/attachment.sig>


More information about the Python-Dev mailing list