[Python-ideas] Dunder method to make object str-like

Donald Stufft donald at stufft.io
Thu Apr 7 15:37:03 EDT 2016

> On Apr 7, 2016, at 3:17 PM, Brett Cannon <brett at python.org> wrote:
> The ternary operator one-liner is backwards-compatible while the ABC is only forward-compatible.

I like the idea of doing both. Make a __fspath__ method and pathlib.fspath that uses it, and then have
an ABC that checks for the existence of __fspath__.

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160407/d95ab592/attachment.html>
-------------- 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-ideas/attachments/20160407/d95ab592/attachment.sig>

More information about the Python-ideas mailing list