-------------------------------------------------- Overview of Problems: --------------------------------------------------
* Too many methods exported. * Poor choice of method names. * Non public classes/methods exported! * Duplicated functionality. -------------------------------------------------- Proposed new functionality: -------------------------------------------------- * New path module will ONLY support one path sep! There is NO reason to support more than one. When we support more than one path sep we help to propagate multiplicity.We should only support the slash and NOT the backslash across ALL OS's since the slash is more widely accepted. If an OS does not have the capability to support only the slash then that OS is not worthy of a Python builtin module. The users of such OS will be responsible for managing their OWN os_legacy.path module. We are moving forward. Those who wish to wallow in the past will be left behind. * Introduce a new method named "partition" which (along with string splitting methods) will replace the six methods "basename", "dirname", "split", "splitdrive", "splitunc", "splittext". The method will return a tuple of the path split into four parts: (drive, path, filename, extension). This is the ONLY splitting method this module needs. All other splits can use string methods. -------------------------------------------------- Expose of the Warts of current module: -------------------------------------------------- ~~~~~~~~~~~~~~~~~~~~~~~~~ 1. Too many methods ~~~~~~~~~~~~~~~~~~~~~~~~~ Follows is a list of what to keep and what to cull: + abspath + altsep - basename --> path.partition[-2] + commonprefix + curdir + defpath + devnull - dirname --> os.path.join(drive,path) + exists + expanduser + expandvars + extsep - genericpath --> should be private! + getatime + getctime + getmtime + getsize + isabs + isdir + isfile + islink + ismount + join - lexists --> duplicate! - normcase --> path = path.lower() - normpath --> should not need this! - os --> should be private! + pardir + pathsep + realpath + relpath + sep - split --> path.rsplit('/', 1) - splitdrive --> path.split(':', 1) - splitext --> path.rsplit('.') - splitunc --> Unix specific! - stat --> should be private! + supports_unicode_filenames --> windows specific! - sys --> should be private! + walk - warnings --> should be private! ~~~~~~~~~~~~~~~~~~~~~~~~~ 2. Poor Name Choices: ~~~~~~~~~~~~~~~~~~~~~~~~~ * basename --> should be: filename * split --> split what? * splitext --> Wow, informative! ~~~~~~~~~~~~~~~~~~~~~~~~~ 3. Non Public Names Exposed! ~~~~~~~~~~~~~~~~~~~~~~~~~ * genericpath * os * stat * sys * warnings Note: i did not check the Unix version of os.path for this. ~~~~~~~~~~~~~~~~~~~~~~~~~ 4. Duplicated functionality. ~~~~~~~~~~~~~~~~~~~~~~~~~ >>> os.path.lexists.__doc__ 'Test whether a path exists. Returns False for broken symbolic links' >>> os.path.exists.__doc__ 'Test whether a path exists. Returns False for broken symbolic links' Should have been one method: >>> os.path.exists(path, ignoreSymLnks=False) -- http://mail.python.org/mailman/listinfo/python-list