A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-December/030950.html below:

[Python-Dev] os.path.commonprefix

[Python-Dev] os.path.commonprefixSkip Montanaro skip@pobox.com
Sat, 7 Dec 2002 10:33:49 -0600
    Armin> I recently discovered that os.path.commonprefix(list-of-strings)
    Armin> returns the longest substring that is an initial segment of all
    Armin> the given strings, and that this has nothing to do with the fact
    Armin> that the strings might be paths.  

:-) I discovered the same thing over a year ago, fixed the problem in CVS,
then got roundly booed because I'd changed the semantics.  I think it broke
some bit of code of Mark Hammond's.  I recently used this function to find
the common prefix in a bunch of email addresses and prefaced it with this
comment:

  # don't be fooled by "os.path." - commonprefix operates char-by-char!
  pfx = os.path.commonprefix(all_addrs)

The Tools/scripts/trace.py file has a component-wise implementation of
commonprefix().

Skip



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