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 max, not sort.  I withdraw it: I also suspect that this function could be made more efficient.  It sorts the sequence.  While sorting is very fast (thanks, Uncle Tim!) it seems a bit OTT in this case.

Thoughts?
Best wishes
Rob Cliffe
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/C7S5C6YISAVYFVLBAQRCS6TS2BDJZANZ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to