[Pythonmac-SIG] Behavior of os.path.join() on the Mac

Jon Moody jbmoody@oakland.edu
Thu, 18 Jan 2001 17:53:16 -0500


I'm familiar with Python on Linux, but the behavior of os.path.join()
in MacPython is confusing me:

<Linux>
>>> r = 'a/b/c'
>>> s = 'd/e/f'
>>> os.path.join(r,s)
'a/b/c/d/e/f'
>>> t = '/x/y/z'
>>> os.path.join(r,t)
'/x/y/z'
>>> os.path.join(t,r)
'/x/y/z/a/b/c'
>>> os.path.join(t,s,r)
'/x/y/z/d/e/f/a/b/c'

<Mac>
>>> r = 'a:b:c'
>>> s = 'd:e:f'
>>> os.path.join(r,s)
'd:e:f'
>>> t = 'Startup Disk:y:z'
>>> os.path.join(r,t)
'Startup Disk:y:z'
>>> os.path.join(t,r)
'a:b:c'
>>> os.path.join(t,s,r)
'a:b:c'


Is it wrong to think of the Mac's Startup Disk as sort of like a root
directory?  Even so, why would MacPython's os.path.join() just throw
away all the path component arguments except the last one with a ':'
inside it? 

Jon