<br><div><span class="gmail_quote">On 22 Mar 2006 06:41:32 -0800, <b class="gmail_sendername"><a href="mailto:ikshefem@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">ikshefem@gmail.com</a>
</b> <<a href="mailto:ikshefem@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">ikshefem@gmail.com</a>> wrote:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I often need to re-code for myself a small code snippet to define<br>string.upto() and 
string.from(), which are used like :</blockquote><div><br>
[snip] <br>
</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"># if not found, return whole string<br>> "hello, world !".upto("#")
<br>"hello, world !"<br>> u"hello, world !".from("#")<br>u"hello, world !"</blockquote><div><br>
[snip]</div><br>
Shouldn't  <br>
<br>
> u"hello, world !".from("#")<br>

u"hello, world !"<br>
<br>
return None,  otherwise what would the difference be between it and<br>
<br>
>u"hello, world !".from("h")<br>
u"hello, world !"<br>
<br>
If it returns the whole string how would you test that a returned value was a not-found rather than a true result?<br>
<br>
> if  u"h" in u"hello, world !" and u"hello, world !".from("h"):<br>
>      return " u"hello, world !"<br>
>else:   # not really required, used for demonstration only<br>
>      return <br>
<br>
:)<br>
<br>
<br>
<br>
</div>