<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 7, 2014, at 2:57 PM, Alexander Belopolsky <<a href="mailto:alexander.belopolsky@gmail.com" class="">alexander.belopolsky@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Oct 6, 2014 at 7:58 PM, Antoine Pitrou <span dir="ltr" class=""><<a href="mailto:solipsis@pitrou.net" target="_blank" class="">solipsis@pitrou.net</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":4n3" class="" style="overflow:hidden">Not inheriting from built-in classes such as str, list or tuple<br class="">
was one of the design points of pathlib. It will not change in the<br class="">
future ;-)<br class="">
<br class="">
PEP 428 outlines this, but you can probably find a more detailed<br class="">
discussion in the python-ideas archive.</div></blockquote></div><br class="">See also rejected PEP 355: "Subclassing from str is a particularly bad idea; many string<br class="">operations make no sense when applied to a path."<br class=""></div><div class="gmail_extra"><br class=""></div><div class="gmail_extra"><a href="http://legacy.python.org/dev/peps/pep-0355/" class="">http://legacy.python.org/dev/peps/pep-0355/</a><br class=""></div><div class="gmail_extra"><br class=""></div><div class="gmail_extra">(I would add that many str operations make no sense - period, so propagating them into newer designs would be a mistake.)</div></div></div></blockquote><br class=""></div><div>Many str operations make no sense when applied to lots of different types of strings, even moreso many bytes methods make no sense when applied to any kind of bytes except a very narrow subset. I’m pretty sure that “does every single method make sense in every scenario” it not a useful distinction to make. However the sheer weight of APIs out there that expect str, and only str means that either pathlib isn’t very useful without wrapping every call in a str() or using some attribute/method on it to convert to str.</div><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">---</div><div class="">Donald Stufft</div><div class="">PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA</div></div></div>
</div>
<br class=""></body></html>