an os.path.join() that doesn't discard before leading slash?
os.path, python
Solution
Maybe `os.environ.get("HOMEPATH").lstrip(os.path.sep)`... it would be trivial to write your own version of `join` that did this on every argument (or the second and subsequent).
Problem
Python's `os.path.join` has been described as "mostly pointless" because it discards any arguments prior to one containing a leading slash. Leaving aside for the moment that this is intentional and documented behaviour, is there a readily available function or code pattern which doesn't discard like this? Given `HOMEPATH=\users\myname`, the following will discard the beginning of the path ``` print os.path.join('C:\one', os.environ.get("HOMEPATH"), 'three') ``` result: ``` \Users\myname\three ``` desired: ``` C:\one\Users\myname\three ``` Having been bitten by this a few times, I'm pretty good now at noticing a leading slash when it's something I've written, but what about when when you don't know what the incoming string is looking like, as in this example?