Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #10546
| 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 | <kb1pkl@aim.com> |
| 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 <kb1pkl@aim.com> |
| To | python-list <python-list@python.org> |
| 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 <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1633.1311972316.1164.python-list@python.org> (permalink) |
| 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 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
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 = 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 pretty,
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 even
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 for
those people, but it certainly isn't the least surprising name. If anything,
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=False)
It is.
/usr/lib64/python2.7/ntpath.py says..
> # alias exists to lexists
> lexists = exists
But over here in Not-NT where we actually *have* symlinks to be broken, it'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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
PyWart: os.path needs immediate attention! rantingrick <rantingrick@gmail.com> - 2011-07-29 10:22 -0700
Re: PyWart: os.path needs immediate attention! Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-29 12:53 -0500
Re: PyWart: os.path needs immediate attention! harrismh777 <harmar@member.fsf.org> - 2011-07-29 14:41 -0500
Re: PyWart: os.path needs immediate attention! "Waldek M." <wm@localhost.localdomain> - 2011-07-29 21:55 +0200
Re: PyWart: os.path needs immediate attention! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-30 10:50 +1000
Function "modes" vs. separate functions (was: PyWart: os.path needs immediate attention!) Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-29 20:15 -0500
Re: Function "modes" vs. separate functions Ben Finney <ben+python@benfinney.id.au> - 2011-07-30 11:57 +1000
Re: Function "modes" vs. separate functions Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-29 21:28 -0500
Re: PyWart: os.path needs immediate attention! Terry Reedy <tjreedy@udel.edu> - 2011-07-30 09:48 -0400
Re: PyWart: os.path needs immediate attention! Robert Kern <robert.kern@gmail.com> - 2011-07-30 23:31 -0400
Re: PyWart: os.path needs immediate attention! Teemu Likonen <tlikonen@iki.fi> - 2011-07-29 23:07 +0300
Re: PyWart: os.path needs immediate attention! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-30 10:57 +1000
Re: PyWart: os.path needs immediate attention! Teemu Likonen <tlikonen@iki.fi> - 2011-08-01 11:19 +0300
Re: PyWart: os.path needs immediate attention! rantingrick <rantingrick@gmail.com> - 2011-08-02 09:03 -0700
Re: PyWart: os.path needs immediate attention! Chris Angelico <rosuav@gmail.com> - 2011-08-02 17:36 +0100
Re: PyWart: os.path needs immediate attention! Chris Angelico <rosuav@gmail.com> - 2011-07-30 06:25 +1000
Re: PyWart: os.path needs immediate attention! Corey Richardson <kb1pkl@aim.com> - 2011-07-29 16:44 -0400
Re: PyWart: os.path needs immediate attention! Alister Ware <alister.ware@ntlworld.com> - 2011-07-29 21:21 +0000
Re: PyWart: os.path needs immediate attention! Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-29 16:36 -0500
Re: PyWart: os.path needs immediate attention! Chris Angelico <rosuav@gmail.com> - 2011-07-30 07:43 +1000
Re: PyWart: os.path needs immediate attention! Terry Reedy <tjreedy@udel.edu> - 2011-07-29 19:30 -0400
Re: PyWart: os.path needs immediate attention! Michael Poeltl <michael.poeltl@univie.ac.at> - 2011-07-30 02:30 +0200
Re: PyWart: os.path needs immediate attention! Grant Edwards <invalid@invalid.invalid> - 2011-07-30 15:33 +0000
Re: PyWart: os.path needs immediate attention! Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-30 10:56 -0500
Re: PyWart: os.path needs immediate attention! alex23 <wuwei23@gmail.com> - 2011-08-02 23:52 -0700
Re: PyWart: os.path needs immediate attention! Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-07-29 22:17 -0700
Re: PyWart: os.path needs immediate attention! Gelonida N <gelonida@gmail.com> - 2011-08-03 11:52 +0200
csiph-web