[Python-ideas] Re: commonprefix

2024-06-17 Thread Rob Cliffe via Python-ideas
On 13/06/2024 02:20, Rob Cliffe wrote: The os.path.commonprefix function basically returns the common initial characters (if any) shared by a sequence of strings, e.g.     os.path.commonprefix(("Python is great!", "Python is not bad", "Python helps")) # returns "Python " The following was wr

[Python-ideas] Re: commonprefix

2024-06-17 Thread Rob Cliffe via Python-ideas
The os.path.commonprefix function basically returns the common initial characters (if any) shared by a sequence of strings, e.g.     os.path.commonprefix(("Python is great!", "Python is not bad", "Python helps")) # returns "Python " The following was wrong.  os.path.commonprefix uses min and ma

[Python-ideas] Re: commonprefix

2024-06-12 Thread Dom Grigonis
This being in `os.path` module suggests that the main intent is to find a common prefix of a `path`. If this is the case, maybe it would be worth instead of: ``` if not isinstance(m[0], (list, tuple)): m = tuple(map(os.fspath, m)) ``` have ``` if not isinstance(m[0], (list, tuple)):

[Python-ideas] Re: commonprefix

2024-06-12 Thread Tim Peters
[Rob Cliffe] > The os.path.commonprefix function basically returns the common initial > characters (if any) shared by a sequence of strings, e.g. > ... > It seems to me that this function (or something similar) should not be > in os.path, but somewhere else where it would be more visible. It's ce