<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Apr 8, 2016 at 2:50 AM, Nick Coghlan <span dir="ltr"><<a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.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="">On 7 April 2016 at 03:26, Brett Cannon <<a href="mailto:brett@python.org">brett@python.org</a>> wrote:<br></span><span class=""></span></blockquote><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> Method or attribute? (changes what kind of one-liner you might use in<br>
> libraries, but I think historically all protocols have been methods and the<br>
> serialized string representation might be costly to build)<br></span></blockquote><div><br></div><div>couldn't it be a property?</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
</span>Method, as long as there's a helper function somewhere</blockquote><div><br></div><div>what has the helper function got to do with whether it's a method or attribute (would we call a property an attribute here?)</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> Built-in? (name is dependent on #1 if we add one)<br>
<br>
</span>os.fspath (alongside os.fsencode and os.fsdecode)<br>
<br>
(Putting this in a module low in the dependency stack makes it easy<br>
for other modules to access without pulling in all of pathlib's<br>
dependencies)</blockquote><div><br></div><div>Iike that -- though still =0.5 on having one at all -- this is only going to be used by the stdlib and other path-using libraries, not user code -- is that that hard to call obj.__fspath__() ?</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> Add the method/attribute to str? (I assume so, much like __index__() is on<br>
> int, but I have not seen it explicitly stated so I would rather clarify it)<br></span></blockquote><div><br></div><div>I thought the whole point off all this is that not any old string can be a path! (whereas any int can be an index). Unless we go with Chris A's suggestion that this be a more generic lossless string protocol, rather than just for paths.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
</span>It's worth summarising in a PEP at least for communications purposes -<br>
very easy for folks that don't follow python-dev to miss otherwise.<br></blockquote><div><br></div><div>I'd say add it to the existing pathlib PEP -- along with the extra discussion of why Path does not inherit from str.</div><div> </div><div>-CHB</div><div><br></div><div><br></div><div> </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>