<div dir="ltr"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">%doctest_mode<br>>>> p = pathlib.Path('//') / 'two' / 'three'<br>>>> p<br>PosixPath('//two/three')<br>>>> 'https' + p<br>Traceback (most recent call last):<br>  File "<ipython-input-37-007abdbe7c66>", line 1, in <module><br>    'https' + p<br>TypeError: cannot concatenate 'str' and 'PosixPath' objects<br><br>>>> 'root(//)' + p<br>Traceback (most recent call last):<br>  File "<ipython-input-38-e2654adaa7b1>", line 1, in <module><br>    'root(//)' + p<br>TypeError: cannot concatenate 'str' and 'PosixPath' objects<br><br>>>> p = pathlib.Path('<a href="https://example.org/">https://example.org/</a>') / 'two' / 'three'<br>>>> p<br>PosixPath('https:/<a href="http://example.org/two/three">example.org/two/three</a>')<br>>>> p + "?query=value" + "#fragment"<br>Traceback (most recent call last):<br>  File "<ipython-input-41-df5e0b32be61>", line 1, in <module><br>    p + "?query=value" + "#fragment"<br>TypeError: unsupported operand type(s) for +: 'PosixPath' and 'str'<br></blockquote><div><div> </div><div>So, something like this would/could be really helpful, for usability:</div><div><br></div><div> <span style="font-size:13px">  from ns/uri/url import URI, http, https</span></div><div><span style="font-size:13px">   from _ import base # "//"</span></div><div style="font-size:13px">   _url = https // 'user@host.netloc:port' / path ** query % fragment</div><div style="font-size:13px">   _url = base // path ** query % fragment<br></div><div style="font-size:13px"><br></div><div style="font-size:13px">   # or, just:</div><div style="font-size:13px">   _url = https / 'user@host.netloc:port' / path ** query % fragment<br></div><div style="font-size:13px">   _url = base / path ** query % fragment<br></div><div style="font-size:13px"><br></div><div style="font-size:13px">An OrderedMultiDict of query vars would also be helpful for</div><div style="font-size:13px">building a union set of GET params joined by not os.path.sep:</div><div style="font-size:13px">* ?key=val args and/or</div><div style="font-size:13px">*  #{'key':'val'} </div><div style="font-size:13px"><br></div><div style="font-size:13px">* OrderedDict.setdefault(key, list)</div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 7, 2015 at 9:53 AM, Senthil Kumaran <span dir="ltr"><<a href="mailto:senthil@uthcode.com" target="_blank">senthil@uthcode.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><span class=""><br><div class="gmail_quote">On Wed, Jan 7, 2015 at 7:36 AM, Paul Moore <span dir="ltr"><<a href="mailto:p.f.moore@gmail.com" target="_blank">p.f.moore@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">That was way too terse. What are you proposing?</blockquote></div><br></span>His proposal seems like a  __div__ method an (no existing yet) URI Object.</div><div class="gmail_extra">But __div__ method for an existing Path Object.</div><div class="gmail_extra"><br></div><div class="gmail_extra">I get the idea, but I am having a hard time understanding the use cases which may not be confusing for common cases.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Question: Does __div__ makes sense for strings? Why does it? I dont think so, but this question I pose has marginal relationship to the proposal.</div><div class="gmail_extra"><br></div><div class="gmail_extra">thanks,</div><div class="gmail_extra">Senthil</div><div class="gmail_extra"><br></div></div>
</blockquote></div><br></div>