Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'sys': 0.05; 'warnings': 0.05; 'agree,': 0.07; 'app,': 0.07; 'path,': 0.07; 'sep': 0.07; 'python': 0.08; 'alias': 0.09; 'backslash': 0.09; 'be:': 0.09; 'broken,': 0.09; 'builtin': 0.09; 'case)': 0.09; 'content- type:multipart/signed': 0.09; 'filename': 0.09; 'filename:fname piece:signature': 0.09; 'header:In-reply-to:1': 0.09; 'method:': 0.09; 'not?': 0.09; 'properly.': 0.09; 'separator.': 0.09; 'skip:\\ 20': 0.09; 'specific.': 0.09; 'splitting': 0.09; 'throw': 0.09; 'tuple': 0.09; 'broken': 0.12; '"\\\\"': 0.16; "'test": 0.16; 'abraham': 0.16; 'agree.': 0.16; 'basename': 0.16; 'before!': 0.16; 'content-type:application/pgp-signature': 0.16; 'dirname': 0.16; 'filename,': 0.16; 'filename:fname piece:asc': 0.16; 'filename:fname:signature.asc': 0.16; 'from:addr:kb1pkl': 0.16; 'from:name:corey richardson': 0.16; 'lowercase': 0.16; 'natively,': 0.16; 'output?': 0.16; 'pathname': 0.16; 'posix': 0.16; 'propagate': 0.16; 'realpath': 0.16; 'richardson': 0.16; 'slashes': 0.16; 'splits': 0.16; 'surprising': 0.16; 'symbolic': 0.16; 'what?': 0.16; 'windows?': 0.16; 'wow,': 0.16; 'argument': 0.16; '>>>': 0.16; 'def': 0.16; 'exists': 0.19; 'exists.': 0.19; 'to:name:python-list': 0.19; 'starts': 0.19; 'support,': 0.21; 'maybe': 0.22; "doesn't": 0.22; 'fri': 0.23; 'though.': 0.23; 'way?': 0.23; '(or': 0.25; 'moving': 0.25; 'string': 0.26; '(in': 0.26; 'windows': 0.26; '(and': 0.27; 'guess': 0.28; 'effect': 0.28; 'fairly': 0.30; 'module': 0.30; '-0400': 0.30; 'behind.': 0.30; 'forward.': 0.30; 'over.': 0.30; 'stat': 0.30; 'looks': 0.30; 'least': 0.31; 'named': 0.32; 'certainly': 0.32; 'explorer': 0.32; 'proposed': 0.32; 'list': 0.32; 'too': 0.32; 'does': 0.32; 'rather': 0.33; 'people,': 0.33; 'anyone': 0.33; 'actually': 0.33; 'to:addr:python-list': 0.34; 'header:User-Agent:1': 0.34; 'operating': 0.34; 'decide': 0.34; 'there': 0.34; 'characters': 0.34; "can't": 0.34; 'things': 0.34; 'agree': 0.35; 'module.': 0.35; 'widely': 0.35; 'uses': 0.35; "isn't": 0.35; 'switch': 0.35; 'skip:" 10': 0.36; 'skip:o 20': 0.36; 'own,': 0.37; 'some': 0.37; 'but': 0.37; 'could': 0.37; 'using': 0.37; 'received:76': 0.38; 'subject:: ': 0.38; 'everyone': 0.38; 'think': 0.38; 'case': 0.39; 'should': 0.39; 'talk': 0.39; 'returned': 0.39; 'help': 0.39; 'received:205': 0.61; 'header:Message-Id:1': 0.61; 'received:205.188': 0.61; 'course.': 0.63; 'received:172.29': 0.64; 'received:r1000.mx.aol.com': 0.64; 'further': 0.65; 'ever': 0.65; 'here': 0.66; 'subject:!': 0.67; 'show': 0.67; 'from:addr:aim.com': 0.67; 'freedom': 0.68; 'wish': 0.70; 'anything,': 0.73; 'care': 0.73; 'introduce': 0.79; '*have*': 0.84; '2011:': 0.84; 'choices:': 0.84; 'methods)': 0.84; 'this!': 0.84; 'worthy': 0.84; '-->': 0.91 Subject: Re: PyWart: os.path needs immediate attention! From: Corey Richardson To: python-list In-reply-to: <14874f59-a836-4031-a8c9-6b24f4d5e812@d7g2000vbv.googlegroups.com> References: <14874f59-a836-4031-a8c9-6b24f4d5e812@d7g2000vbv.googlegroups.com> Date: Fri, 29 Jul 2011 16:44:09 -0400 User-Agent: Sup/0.12.1 Content-Transfer-Encoding: 8bit MIME-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-sha256"; boundary="=-1311972252-670959-20397-8252-1-="; protocol="application/pgp-signature" x-aol-global-disposition: G X-AOL-VSS-INFO: 5400.1158/72866 X-AOL-VSS-CODE: scan_error X-AOL-SCOLL-SCORE: 0:2:487231808:93952408 X-AOL-SCOLL-URL_COUNT: 0 x-aol-sid: 3039ac1d33864e331bcd21eb X-AOL-IP: 76.119.157.207 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 218 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1311972316 news.xs4all.nl 23876 [2001:888:2000:d::a6]:50797 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:10546 --=-1311972252-670959-20397-8252-1-= Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: quoted-printable Excerpts from rantingrick's message of Fri Jul 29 13:22:04 -0400 2011: > -------------------------------------------------- > 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. People who use windows are used to \ being their pathsep. If you show them a path that looks like C:/whatever/the/path in an app, they are going to think you are nuts. It isn't up to us to decide what anyone uses as a path separator. They use \ natively, so should we. If at any point Windows as an OS starts using /'s, and not support, actually uses (in Windows Explorer as default (or whatever the filebrowser's name is)), it would be great to switch over. > * 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. I agree, although what if one wants to further split the returned path, in an OS-independent way? Just because we want all pathseps to be /, doesn't mean they are (and I personally don't care either way). > ~~~~~~~~~~~~~~~~~~~~~~~~~ 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 =3D path.lower() Not quite, here are a few implementations of normcase (pulled from 2.7) # NT def normcase(s): """Normalize case of pathname. = = = = Makes all characters lowercase and all slashes into backslashes.""" return s.replace("/", "\\").lower() # Mac (Correct in this case) def normcase(path): return path.lower() # POSIX def normcase(s): """Normalize case of pathname. Has no effect under Posix""" return s But I can't think of where I would ever use that. Isn't case important on= Windows? = > - normpath --> should not need this! Why not? It provides an OS-independent way to make the pathname look pret= ty, maybe for output? I don't really see a use for it, to be honest. But I'd = rather there be a working solution in the stdlib than have everyone need = to throw in their own that might not handle some things properly. Talk about= multiplicity! > - os --> should be private! > + pardir > + pathsep > + realpath > + relpath > + sep > - split --> path.rsplit('/', 1) And on those operating systems where "\\" is the pathsep? > - splitdrive --> path.split(':', 1) > - splitunc --> Unix specific! Err...no. It's for UNC paths, as in \\server\mount\foo\bar. It's not eve= n in posixpath.py, so in no way could it ever be 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 I agree. The name is a carryover from basename(1) and I guess it's good f= or those people, but it certainly isn't the least surprising name. If anythi= ng, I would think the base is everything before! > * split --> split what? The path, of course. On its own, it's uninformative, but considering the whole name is "os.path.split", it's fairly intuitive. > * splitext --> Wow, informative! split extension...seems straightforward to me. > ~~~~~~~~~~~~~~~~~~~~~~~~~ > 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=3DFalse) It is. /usr/lib64/python2.7/ntpath.py says.. > # alias exists to lexists = = > lexists =3D exists But over here in Not-NT where we actually *have* symlinks to be broken, i= t's >>> os.path.lexists.__doc__ 'Test whether a path exists. Returns True for broken symbolic links' >>> os.path.exists.__doc__ 'Test whether a path exists. Returns False for broken symbolic links I agree that it should be an argument to os.path.exists, though. -- = Corey Richardson "Those who deny freedom to others, deserve it not for themselves" -- Abraham Lincoln --=-1311972252-670959-20397-8252-1-= Content-Disposition: attachment; filename="signature.asc" Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) iQEcBAEBCAAGBQJOMxucAAoJEAFAbo/KNFvpM7QIAICiWYI6Y/Ipr4jyF1YgsYhN m/9BpYjqU9F/isiiRSGrnitpFWrjG2FoKc9w71/4JExHg1XIhrUJI0kg4LeofTOE Qm2pWEzxNZkMVdC3c3BzInYhRoxof2UZhp1gDkRpw1cJcm/6vm9mGarqd3kBxa90 +edqSUDvQV7MPydn99gI0Kw2gE+OFi6363UlsRCJZSh8gu2mFn0uBKRQGXwOdUc5 VOjgCUcoHuu/qfK5TP479KGiJQWh1//5P+iLPnKdapIeBs79Tog8yV5S47fdPe5e 3k4VC9jEF7KVGhB1L1V7EDQg7bojYDTcT1+H8kFFlSvK1YHLJdozh5MbBnwSVg4= =o+aC -----END PGP SIGNATURE----- --=-1311972252-670959-20397-8252-1-=--