<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Apr 7, 2016 at 11:28 AM, Chris Angelico <span dir="ltr"><<a href="mailto:rosuav@gmail.com" target="_blank">rosuav@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Fair enough. That was a spur-of-the-moment thought. To be honest, this<br>
proposal is a massive generalization from, ultimately, a single<br>
use-case.</blockquote><div><br></div><div>yes, but now that you say:</div><div><br></div><div>... </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">And this should make it easier for third-party code to be functional<br>
without even being aware of the Path object. There are two basic<br>
things that code will be doing with paths: passing them unchanged to<br>
standard library functions (eg open()), and combining them with<br>
strings. The first will work by definition; the second will if paths<br>
can implicitly upcast to strings.<br></blockquote><div><br></div><div>so this is really a way to make the whole path!=string thing easier -- we don't want to simply call str() on anything that might be a path, because that will work on anything, whether it's the least bit pathlike at all, but this would introduce a new kind of __str__, so that only things for which it makes sense would "Just work":</div><div><br></div><div>str + something</div><div><br></div><div>Would only concatenate to a new string if somethign was an object that couuld "losslessly" be considered a string?</div><div><br></div><div>but if we use the __index__ example, that is specifically "an integer that can be ued as an index", not "something that can be losslessly converted to an integer".</div><div><br></div><div>so why not the __fspath__ protocol anyway?</div><div><br></div><div>Unless there are all sorts of other use cases you have in mind?</div><div><br></div><div>-CHB</div><div><br></div></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>