<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jan 25, 2017 at 11:04 AM, Thomas Kluyver <span dir="ltr"><<a href="mailto:thomas@kluyver.me.uk" target="_blank">thomas@kluyver.me.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>
<div><div>On Wed, Jan 25, 2017, at 03:54 PM, Todd wrote:<br></div>
<blockquote type="cite"><div dir="ltr"><div><div><div>Those [.tar.foo] are just examples that I encounter a lot, there can be other cases where multiple extensions are used.<br></div>
</div>
</div>
</div>
</blockquote><div><br></div>
<div>The real issue is that there's no definition of what an extension is. You can have dots anywhere in a filename, and it's not at all unusual for them to be used before the bit we recognise as the extension. Almost every package on PyPI has files named like 'pip-9.0.1.tar.gz', but '.0.1.tar.gz' clearly doesn't make any sense as an extension. Without a good definition of what the 'full extension' is, we can't have code to find it.<span class="gmail-HOEnZb"><font color="#888888"><br></font></span></div><span class="gmail-HOEnZb"><font color="#888888">
<div><br></div>
<div>Thomas<br></div>
</font></span></div><br></blockquote></div><br><br></div><div class="gmail_extra">Right, that is why we would have three properties<br><br>1. suffix: gets the part after the last period as a string, including the period (already exists), so "spam.tar.gz" -> ".gz"<br>2. fullsuffix: gets the part after the first period as a string, including the period (this is what I am proposing), so "spam.tar.gz" -> ".gz"<br></div><div class="gmail_extra">3. suffixes: gets the part after the first period as a list of strings split on the leading period, each including the leading period (already exists), so "spam.tar.gz" -> [".tar", ".gz"]<br><br></div><div class="gmail_extra">"suffix" is only useful if you are sure only the part after the last period is useful, "fullsuffix" is only useful if you are sure the entire part after first period is useful, and "suffixes" is needed in more complicated situations. This is similar in principle to having "str.split", "str.rsplit", "str.partition", and "str.rpartition". pathlib currently has the equivalent of "str.split" (suffixes) and "str.rpartition" (suffix), but lacks the equivalent of "str.partition" (fullsuffix).<br></div></div>