invert or reverse a string... warning this is a rant

Carl Banks pavlovevidence at gmail.com
Fri Oct 20 16:31:02 EDT 2006


Istvan Albert wrote:
> Carl Banks wrote:
>
> > Say you're using a function from a third-party library that finds the
> > first character in a string that meets some requirement.  You need to
> > find the last such character.
>
> You seem to imply that invoking a function on a reversed input is
> somehow a generic solution to the problem (finding first vs finding
> last) that you describe above above.

Nope, I wasn't.

> That would be the exception rather than the rule.

Oh, don't be such a Debbie Downer.  The rule is, it works as long as
the character you're looking for isn't relative to any other character
in the string.

(Geez, I was just giving a counterexample.)


Carl Banks




More information about the Python-list mailing list