Ville Vainio wrote:
>>>>>>"Peter" == Peter Hansen <[EMAIL PROTECTED]> writes:
>     Peter> Sion Arrowsmith wrote:
>     >> But can you come up with a method for remembering which way
>     >> round str.find() and str.index() are?
> 
>     Peter> Don't use "str" and you won't have anything to remember:
> 
>     Peter> 'foo bar baz'.find('spam')
>     Peter> 'spanish inquisition'.index('parrot')
> 
> But which one raises an exception, and which one returns -1?

Ah, is that what Sion meant by "which way around"?  Obviously that was 
an ambiguous question, since I thought he was referring to the order of 
the arguments.

My answer to the other question, unfortunately, is "I just type one of 
them at an interpreter prompt and see which result I get".  Much faster 
than checking the docs...    ;-)

-Peter
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to