A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2003-January/032228.html below:

longest common prefix of two strings

[Python-Dev] String method: longest common prefix of two strings [Python-Dev] String method: longest common prefix of two stringskent@lysator.liu.se kent@lysator.liu.se
19 Jan 2003 12:20:03 +0100
I'd like to get some feedback on a new string method which might
be useful: getting the longest common prefix of two strings.

Questions:

1. First of all: YAGNI or not?

   I have an application where I could use this. I will be importing
   emails from a trouble-ticket system into another system. The body
   of a trouble ticket contains a log of actions. To find the new log
   entries, I'd like to compare the bodies of the last and next-to-last
   email.

2. Is there a need for a fast built-in operation coded in C?
   Should I use difflib instead?

3. Is s1.commonprefix(s2) OK? Or should the name be different?
   s1.longestcommonprefixwith(s2) is a bit awkward to write...

4. Should the method return the length of the common prefix instead
   of the common prefix itself?

5. Should there be a suffix version too?

I would be willing to provide the necessary patches to stringobject.c,
test_string.py and libstdtypes.tex.


Regards,
/ Kent Engstr=F6m, kent@lysator.liu.se



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4