saltstack/salt — pull request #1779 by s0undt3ch (2012-08-06 23:32:25+00:00)
Title: Stop using `os.sep.join` to join paths.

Stop using `os.sep.join` to join paths.

Python has a specific function to join paths for a reason. Let's see some examples why:
```python
>>> import os
>>> p1 = '/'
>>> p2 = 'foo'
>>> os.path.join(p1, p2)
'/foo'
>>> os.sep.join([p1, p2])
'//foo'
>>> p2 = '/foo'
>>> os.sep.join([p1, p2])
'///foo'
>>> os.path.normpath(os.sep.join([p1, p2]))
'/foo'
>>> p2 = 'foo'
>>> os.path.normpath(os.sep.join([p1, p2]))
'//foo'
>>> p2 = '/foo'
>>> os.path.join(p1, p2)
'/foo'
>>>
```

Also, python docs also state that knowing the OS separator is not always enough to parse/join paths, see http://docs.python.org/library/os#os.sep

There are some posts on the internet which state that `os.sep.join` is faster than `os.path.join`, and, most likely it is, but is it **that** faster? Does that really make a difference in salt's context, specially since it's error prone as shown above?