python-dev Summary for 2003-01-16 through 2003-01-31

Andrew Dalke adalke at mindspring.com
Thu Feb 6 05:47:16 EST 2003


Brett C. wrote:
> +++++++++++++++++++++++++++++++++++++++++++++++++++++
> python-dev Summary for 2003-01-16 through 2003-01-31
> +++++++++++++++++++++++++++++++++++++++++++++++++++++
  ...
> `String method: longest common prefix of two strings
> <http://mail.python.org/pipermail/python-dev/2003-January/032228.html>`__
> 	Didn't go anywhere; Guido said he doesn't want to add every useful
> thing as a string method since there are already so many.

Isn't that what os.path.commonprefix already does?


 >>> import os
 >>> os.path.commonprefix(["This is a line", "This is another line", 
"This isn't
for you"])
'This is'
 >>>


I know it's in a strange spot, and I never liked that the
common prefix of

   /home/dalke and /home/dalkea

is "/home/dalke" when I wanted "/home".  Still, the functionality
already exists and is more powerful than a string method which
only takes two strings at a time.

(The implementation is slow, but that's a different point.)


					Andrew
					dalke at dalkescientific.com





More information about the Python-list mailing list