Comparing strings from the back?
Dan Sommers
dan at tombstonezero.net
Tue Sep 4 00:56:51 EDT 2012
On 2012-09-04 at 02:17:30 +0000,
Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:
> Besides, then somebody will say "Yes, but what about the cases where
> the prefix and the suffix are both equal, but the middle will be
> different?" and propose a third string-equality operator ==== and
> then there will be bloodshed.
Lisp has several equality forms, although they're for different kinds or
levels of equality rather than for different algorithms for determining
that equality. I imagine that a discussion similar to this one spawned
many of those forms. I agree with Steven: decisions such as this
belong to the application developer, not the standard library. Don't
forget the fourth string-equality operator for case-insensitive
comparisons and the fifth string-equality operator for strings that are
likely to be palindromes.
That said, if I really wanted bloodshed, I would propose = for the third
string-equality operator! ;-)
Dan
More information about the Python-list
mailing list