Collin Funk wrote: > But I am still confused about what the point of 'newtail' is: > > def joinpath(head: str, *tail: str) -> str: > '''Join two or more pathname components, inserting '/' as needed. If any > component is an absolute path, all previous path components will be > discarded. > This function also replaces SUBDIR/../ with empty; therefore it is not > suitable when some of the pathname components use Makefile variables > such as '$(srcdir)'.''' > newtail = [] > for item in tail: > newtail.append(item)
It's an unused local variable. Probably a left-over from an earlier code. > > Now this is no longer the case, with consequences: > > - Maybe the patch introduced bugs (not caught by the test suite). > > - Surely it will make maintenance harder, because everywhere we deal > > with a file name, we will have to ask ourselves "is it normalized > > or not?" > > That was already kind-of a problem hence os.path.join() instead of > joinpath() in some places. To preserve ./configure.ac vs. configure.ac > in comments to match gnulib-tool.sh for example. > > Maybe it is best to just use normalized paths everywhere Yes, that's my point. Instead of using unnormalized file names nearly everywhere and normalized file names only in a few places, it is better to use normalized file names nearly everywhere and unnormalized file names only in a few places. It causes fewer bugs and less head-aches. And it is what the previous 'joinpath' function did achieve. Bruno