Showing content from http://mail.python.org/pipermail/python-dev/attachments/20160407/45c2a8d3/attachment-0001.html below:
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Apr 7, 2016 at 11:44 AM, Nathaniel Smith <span dir="ltr"><<a href="mailto:njs@pobox.com" target="_blank">njs@pobox.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><p dir="ltr">No, __index__ is the protocol for "do a safe coerce to integer". The name is misleading, but its use in non-indexing contexts is well established. E.g.<br></p></span>
<p dir="ltr">" ab" * obj</p>
<p dir="ltr">will return a string with obj.__index__() repetitions.</p></blockquote><div>A good argument for Chris A's proposal over on python-ideas to have a dunder method for "coerce to a lossless string", that could be used for Path, but also for who knows what else?</div><div><br></div><div>As I see it , exactly the same as the __fspath__ idea, except that we'd use a name that made it clear you might want to use it for other things (and str would grow that method...)</div><div><br></div><div>-CHB</div><div>Â </div></div><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R Â Â Â Â Â Â (206) 526-6959Â Â voice<br>7600 Sand Point Way NE Â Â (206) 526-6329Â Â fax<br>Seattle, WA Â 98115 Â Â Â Â (206) 526-6317Â Â main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</div></div>
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4