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/030947.html below:

[Python-Dev] os.path.commonprefix

[Python-Dev] os.path.commonprefix [Python-Dev] os.path.commonprefixArmin Rigo arigo@tunes.org
Sat, 7 Dec 2002 08:02:18 -0800 (PST)
Hello everybody,

I recently discovered that os.path.commonprefix(list-of-strings) returns
the longest substring that is an initial segment of all the given strings,
and that this has nothing to do with the fact that the strings might be
paths.  I wonder why this has been put in os.path and not in the string
module in the first place.  This location misled me for a long time into
thinking that commonprefix() would return the longest common *path*, a
feature whose interest I could see.  But:

>>> commonprefix(['/home/users/arigo', '/home/users/alal'])
'/home/users/a'

What is the use for such a thing ??

I suggest that a more descriptive comment be added in the documentation.


Armin




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