searching backwards in a string

chajadan python at chajadan.net
Wed Feb 13 06:00:39 EST 2002


The direction I'd say, should not be implied.

When I was beginning my ventures in programming, I would have said "Yes! 
Yes! It's so obviously implied, so let it be implied." but oddly enough, I 
now find myself seeing many non-trivial reasons to not imply the direction.

Besides, leaving a way to dictate the direction means you won't have to 
override the assumed direction that one weird day you realize you don't 
want it just to go in the direction ~it~ thinks is best ;)

--chajadan

At 10:33 PM 2/12/02 -0600, Skip Montanaro wrote:

>     Paul> here 50000 and -1 are the starting and ending locations.
>
>     Skip> If start > end isn't direction == -1 implied?
>
>     Paul> Nope.  I tried it and it didn't search backwards.
>
>That wasn't quite what I was asking.  Let me ask it a slightly different
>way.  Presuming the behavior can be changed so that searching in reverse
>works, shouldn't the ordering of start and end be sufficient to indicate the
>direction of the search?
>
>--
>Skip Montanaro (skip at pobox.com - http://www.mojam.com/)
>
>--
>http://mail.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list