<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">вс, 31 мар. 2019 г. в 11:45, Kirill Balunov <<a href="mailto:kirillbalunov@gmail.com">kirillbalunov@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">вс, 31 мар. 2019 г. в 11:36, Steven D'Aprano <<a href="mailto:steve@pearwood.info" target="_blank">steve@pearwood.info</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">There's a slight problem with that: what happens if more than one suffix <br>
matches? E.g. given:<br>
<br>
    "musical".lcut(('al', 'ical'))<br>
<br>
should the suffix "al" be removed, leaving "music"? (First match wins.)<br>
<br>
Or should the suffix "ical" be removed, leaving "mus"? (Longest match <br>
wins.)<br><br></blockquote><div><br></div><div>I think you should choose  "First match wins", because in this case you can make "Longest match wins" as <font face="monospace, monospace">`"musical".lcut(tuple(sorted(('al, 'ical'))))`. But if you </font><font face="arial, helvetica, sans-serif">choose</font><font face="monospace, monospace"> </font>"Longest match wins" there is no chance to achieve "First match wins" behaviour.</div><div><br></div><div>with kind regards,</div><div>-gfg</div></div></div></blockquote><div><br></div><div>Sorry it should be `<font face="monospace, monospace">.rcut</font>` instead of `<font face="monospace, monospace">.lcut</font>`  in <span style="font-family:monospace,monospace">`"musical".<b>rcut</b>(tuple(</span><span style="font-family:monospace,monospace">sorted(('al, 'ical'))))` </span><font face="arial, helvetica, sans-serif">at the first place</font><span style="font-family:monospace,monospace">. </span><font face="arial, helvetica, sans-serif">I will prefer names `</font><font face="monospace, monospace">.lstrip</font><font face="arial, helvetica, sans-serif">` and `</font><font face="monospace, monospace">.rstrip</font><font face="arial, helvetica, sans-serif">` instead of *cut versions.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">with kind regards,</font></div><div><font face="arial, helvetica, sans-serif">-gdg</font></div></div></div>