Under Unix, os.path.normpath collapses multiple slashes into single ones except when exactly two slashes appear that the start of the path. Why the exception?
To illustrate, I get the following transformations:
//double/slash/stays -> //double/slash/stays
/double/slash//gone// -> /double/slash/gone/
double//slash//gone/ -> double/slash/gone
///triple/slash/gone -> /triple/slash/gone
////quad/slash/gone -> /quad/slash/gone
This seems strange to me. I can vaguely imagine this is useful for SMB mounts or URLS, but I don't think I care about those. Is there any hidden wisdom to Python's behaviour, or should I just collapse the leading // myself?
[update] In view of the answer below, it looks like the best thing is not to collapse the //, but to either just accept it, or to treat it as an error.