os.sep and os.path.sep

O.R.Senthil Kumaran orsenthil at gmail.com
Sun Sep 9 20:22:57 EDT 2007


* billiejoex <gnewsg at gmail.com> [2007-09-09 08:48:38]:

> >>> import os
> >>> hasattr(os, 'sep')
> True
> >>> hasattr(os.path, 'sep')
> True
> 
> By chance I noticed it.
> Are there differences (I think not...)?
> IMHO, if there are no differences os.path.sep should be removed since
> it may be confusing.

If you lookup os module, not only os.sep but couple of other values are also imported from os.path. 

from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep,
    devnull)

Yes, you are right. There are no differences. They exists there for utility purposes. Removing them would be a bad idea.

-- 
O.R.Senthil Kumaran
http://uthcode.sarovar.org



More information about the Python-list mailing list