Just throwing it out but what about something like:<br><br>found, index = text.index(&quot;abc&quot;)<br><br>if found:<br>&nbsp;&nbsp; doSomething(index)<br><br>If you were confident that the index was in there you would do something more like this:
<br><br>something = text[text.index(&quot;abc&quot;)[1]:]<br><br>(although there are clearer ways to do that)<br><br><div><span class="gmail_quote">On 8/23/06, <b class="gmail_sendername">Steven Bethard</b> &lt;<a href="mailto:steven.bethard@gmail.com">
steven.bethard@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On 8/23/06, Barry Warsaw &lt;<a href="mailto:barry@python.org">
barry@python.org</a>&gt; wrote:<br>&gt; I agree with Tim -- if we have to get rid of one of them, let's get<br>&gt; rid of index/rindex and keep find/rfind.&nbsp;&nbsp;Catching the exception is<br>&gt; much less convenient than testing for -1.
<br><br>Could you post a simple example or two?&nbsp;&nbsp;I keep imagining things like::<br><br>&nbsp;&nbsp;&nbsp;&nbsp;index = text.index(...)<br>&nbsp;&nbsp;&nbsp;&nbsp;if 0 &lt;= index:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;... do something with index ...<br>&nbsp;&nbsp;&nbsp;&nbsp;else:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br><br>which looks about the same as::
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;try:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;index = text.index(...)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;... do something with index ...<br>&nbsp;&nbsp;&nbsp;&nbsp;except ValueError:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br><br>Is it just that a lot of the else clauses are empty?<br><br>STeVe<br>--<br>I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
<br>tiny blip on the distant coast of sanity.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--- Bucky Katt, Get Fuzzy<br>_______________________________________________<br>Python-3000 mailing list<br><a href="mailto:Python-3000@python.org">Python-3000@python.org
</a><br><a href="http://mail.python.org/mailman/listinfo/python-3000">http://mail.python.org/mailman/listinfo/python-3000</a><br>Unsubscribe: <a href="http://mail.python.org/mailman/options/python-3000/paul%40prescod.net">
http://mail.python.org/mailman/options/python-3000/paul%40prescod.net</a><br></blockquote></div><br>