[Python-ideas] os.path.commonpath()

Serhiy Storchaka storchaka at gmail.com
Tue Nov 6 16:27:28 CET 2012


See http://bugs.python.org/issue10395.

os.path.commonpath() should be a function which returns right longest common sub-path for specified paths (os.path.commonprefix() is completely useless for this).

There are some open questions about details of *right* behavior.



What should be a common prefix of '/var/log/apache2' and
 '/var//log/mysql'?
What should be a common prefix of '/usr' and '//usr'?
What should be a common prefix of '/usr/local/' and '/usr/local/'?
What should be a common prefix of '/usr/local/' and '/usr/local/bin'?
What should be a common prefix of '/usr/bin/..' and '/usr/bin'?

Please, those who are interested in this feature, give consistent answers to these questions.




More information about the Python-ideas mailing list