Re: [Python-3000] Path Reform: Get the ball rolling

2006-11-01 Thread Mike Orr
On 10/31/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > Why is 'split' in os.path but 'stat' and 'mkdir' and 'remove' are in > > os? Don't they all operate on paths? > > no. are you saying that you're unable to see the conceptual difference > between a name and an object? I see the differenc

Re: [Python-3000] Path Reform: Get the ball rolling

2006-11-01 Thread Talin
More comments... Mike Orr wrote: > Talin wrote: >> 1) Does os.path need to be refactored at all? > > Yes. Functions are scattered arbitrarily across six modules: os, > os.path, shutil, stat, glob, fnmatch. You have to search through five > scattered doc pages in the Python library to find your

Re: [Python-3000] Path Reform: Get the ball rolling

2006-11-01 Thread Michael Urman
>p = os.path.normpath( os.path.join( __file__, "../..", "lib" ) ) Shouldn't an example avoid using the path separator directly within a string literal? p = path.normpath(path.join(__file__, "..", "..", "lib")) -- Michael Urman ___ Python-3

Re: [Python-3000] Path Reform: Get the ball rolling

2006-11-01 Thread Oleg Broytmann
On Wed, Nov 01, 2006 at 08:03:55AM -0600, Michael Urman wrote: > >p = os.path.normpath( os.path.join( __file__, "../..", "lib" ) ) > > Shouldn't an example avoid using the path separator directly within a > string literal? > > p = path.normpath(path.join(__file__, "..", "..", "lib"))

Re: [Python-3000] Alternatives to 'outer'

2006-11-01 Thread Jim Jewett
On 10/29/06, Gary Stephenson <[EMAIL PROTECTED]> wrote: > I would like to suggest the spelling "free", as I believe the term "free > variable" has been widely used to describe the concept (albeit > usually in reference to undeclared variables.) They are currently called free variables (or cell va

[Python-3000] Draft PEP for outer scopes

2006-11-01 Thread Ka-Ping Yee
Hi folks, I have finally completed a draft of a PEP on rebinding of names in outer scopes. I've tried to go back and gather all of the (amazingly numerous) proposals -- if i've forgotten or misattributed any, let me know and i'll be happy to correct them. I look forward to your thoughts on it:

Re: [Python-3000] Draft PEP for outer scopes

2006-11-01 Thread Ka-Ping Yee
I wrote: > I have finally completed a draft of a PEP on rebinding of names [...] > http://zesty.ca/python/pep-3104.txt I've turned this into HTML also, in case you find that easier to read: http://zesty.ca/python/pep-3104.html -- ?!ng ___ Pyth

Re: [Python-3000] Path Reform: Get the ball rolling

2006-11-01 Thread Josiah Carlson
Oleg Broytmann <[EMAIL PROTECTED]> wrote: > On Wed, Nov 01, 2006 at 08:03:55AM -0600, Michael Urman wrote: > > >p = os.path.normpath( os.path.join( __file__, "../..", "lib" ) ) > > > > Shouldn't an example avoid using the path separator directly within a > > string literal? > > > > p

Re: [Python-3000] Path Reform: Get the ball rolling

2006-11-01 Thread Talin
Michael Urman wrote: >>p = os.path.normpath( os.path.join( __file__, "../..", "lib" ) ) > > Shouldn't an example avoid using the path separator directly within a > string literal? > >p = path.normpath(path.join(__file__, "..", "..", "lib")) No need. 'normpath' will automatically conv

Re: [Python-3000] Path Reform: Get the ball rolling

2006-11-01 Thread Ron Adam
Talin wrote: > Now, that being said, I wouldn't have a problem with there being an > "abstract filesystem object" that represents an entity on disk (be it > file, directory, etc.), which would have a path inside it that would do > some of the things you suggest. I think this option should be e

Re: [Python-3000] Path Reform: Get the ball rolling

2006-11-01 Thread Oleg Broytmann
On Wed, Nov 01, 2006 at 08:32:08AM -0800, Josiah Carlson wrote: > > p = path.normpath(path.join(__file__, os.pardir, os.pardir, "lib")) > > What operating systems that Python currently supports doesn't have ".." > mean "parent directory"? macpath.py defines pardir = '::'. MacOS 9, probably. O

Re: [Python-3000] Path Reform: Get the ball rolling

2006-11-01 Thread Josiah Carlson
Oleg Broytmann <[EMAIL PROTECTED]> wrote: > > On Wed, Nov 01, 2006 at 08:32:08AM -0800, Josiah Carlson wrote: > > > p = path.normpath(path.join(__file__, os.pardir, os.pardir, "lib")) > > > > What operating systems that Python currently supports doesn't have ".." > > mean "parent directory"? >

Re: [Python-3000] Draft PEP for outer scopes

2006-11-01 Thread Mark Russell
On 1 Nov 2006, at 15:17, Ka-Ping Yee wrote: > I have finally completed a draft of a PEP on rebinding of names > in outer scopes. Nice summary - thanks for all the work. > I look forward to your thoughts on it: Minor point: it might be worth mentioning (in the section "Rebinding Operator") that

Re: [Python-3000] Draft PEP for outer scopes

2006-11-01 Thread Michael Chermside
?!ng writes: > I have finally completed a draft of a PEP on rebinding of names > in outer scopes. I've tried to go back and gather all of the > (amazingly numerous) proposals And you've done an astonishingly good job of it. The amount of history in this PEP is impressive, and it demonstrates the

Re: [Python-3000] Path Reform: Get the ball rolling

2006-11-01 Thread Mike Orr
The thread on python-dev has been revived, so those interested in this subject will want to look in both places. On 11/1/06, Talin <[EMAIL PROTECTED]> wrote: > Actually I generally use: > >p = os.path.normpath( os.path.join( __file__, "../..", "lib" ) ) > > or even: > >p = os.path.

Re: [Python-3000] Path Reform: Get the ball rolling

2006-11-01 Thread Marcin 'Qrczak' Kowalczyk
"Mike Orr" <[EMAIL PROTECTED]> writes: > /a/b/../c# Previous component is always a directory, so eliminate. This is not equivalent to a/c on Unix if b is a symlink to a directory, because .. goes to the parent of the target of the symlink. -- __("< Marcin Kowalczyk \__/

Re: [Python-3000] Draft PEP for outer scopes

2006-11-01 Thread Neil Toronto
Ka-Ping Yee wrote: > Hi folks, > > I have finally completed a draft of a PEP on rebinding of names > in outer scopes. I've tried to go back and gather all of the > (amazingly numerous) proposals -- if i've forgotten or misattributed > any, let me know and i'll be happy to correct them. > > I look

Re: [Python-3000] Draft PEP for outer scopes

2006-11-01 Thread Guido van Rossum
On 11/1/06, Neil Toronto <[EMAIL PROTECTED]> wrote: > Ka-Ping Yee wrote: > > I have finally completed a draft of a PEP on rebinding of names > > in outer scopes. I've tried to go back and gather all of the > > (amazingly numerous) proposals -- if i've forgotten or misattributed > > any, let me kno

Re: [Python-3000] Draft PEP for outer scopes

2006-11-01 Thread Brett Cannon
On 11/1/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: On 11/1/06, Neil Toronto <[EMAIL PROTECTED]> wrote:> Ka-Ping Yee wrote:> > I have finally completed a draft of a PEP on rebinding of names> > in outer scopes.  I've tried to go back and gather all of the > > (amazingly numerous) proposals -- i

Re: [Python-3000] Draft PEP for outer scopes

2006-11-01 Thread Greg Ewing
Guido van Rossum wrote: > My personal preference is still to abuse 'global' instead of adding a > new, ugly keyword. That would make the syntax for global and nonlocal > completely identical. :-) But I seem to be alone in this preference. You're not alone -- I'd be happy with that, too. I don't e

Re: [Python-3000] Draft PEP for outer scopes

2006-11-01 Thread Michael Spencer
Ka-Ping Yee wrote: > Hi folks, > > I have finally completed a draft of a PEP on rebinding of names > in outer scopes. I've tried to go back and gather all of the > (amazingly numerous) proposals -- if i've forgotten or misattributed > any, let me know and i'll be happy to correct them. > > I loo

Re: [Python-3000] Draft PEP for outer scopes

2006-11-01 Thread Ka-Ping Yee
Hi again. I've updated the PEP to incorporate some suggestions i received. This revision also adds a Ruby example, a quote from 1994, a security argument, and and an additional error case (attempting to declare a parameter name nonlocal). Thanks, everyone! http://zesty.ca/python/pep-3104.txt

Re: [Python-3000] Draft PEP for outer scopes

2006-11-01 Thread Ka-Ping Yee
Guido wrote: > My personal preference is still to abuse 'global' instead of adding a > new, ugly keyword. That would make the syntax for global and nonlocal > completely identical. :-) But I seem to be alone in this preference. Brett wrote: > Seeing Guido have a sad face is enough to force me to h

Re: [Python-3000] Draft PEP for outer scopes

2006-11-01 Thread Andrew McNamara
>Guido wrote: >> My personal preference is still to abuse 'global' instead of adding a >> new, ugly keyword. That would make the syntax for global and nonlocal >> completely identical. :-) But I seem to be alone in this preference. > >Brett wrote: >> Seeing Guido have a sad face is enough to force

Re: [Python-3000] Draft PEP for outer scopes

2006-11-01 Thread Terry Reedy
"Andrew McNamara" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > >Guido wrote: >>> My personal preference is still to abuse 'global' instead of adding a >>> new, ugly keyword. That would make the syntax for global and nonlocal >>> completely identical. :-) But I seem to be alone in

Re: [Python-3000] Draft PEP for outer scopes

2006-11-01 Thread Steven Bethard
Guido wrote: > My personal preference is still to abuse 'global' instead of adding a > new, ugly keyword. That would make the syntax for global and nonlocal > completely identical. :-) But I seem to be alone in this preference. Brett wrote: > Seeing Guido have a sad face is enough to force me to h

Re: [Python-3000] Draft PEP for outer scopes

2006-11-01 Thread Ka-Ping Yee
Ka-Ping Yee wrote: > Would it help at all to survey some folks to see how many interpret > "global variable" to mean "top-level" vs. "anything nonlocal"? Steven Bethard wrote: > I don't think that'll really be worth it. I'd be amazed if people > didn't expect it to mean "top-level". If that's a

Re: [Python-3000] Draft PEP for outer scopes

2006-11-01 Thread Steven Bethard
On 11/1/06, Ka-Ping Yee <[EMAIL PROTECTED]> wrote: > I think a fairer survey example would be something like this: > > n = 1 > def f(): > n = 2 > def g(): > global n = 99 > return n > g() > > f() > print n > > Which 'n' do you expect g

Re: [Python-3000] Draft PEP for outer scopes

2006-11-01 Thread Ka-Ping Yee
I wrote: > I'm convinced that "global variable" means top-level for most > programmers and so this usage would be confusing -- but i think we're > all just repeating what we've said before. Andrew McNamara wrote: > But it doesn't mean "top-level" - it already comes with the qualifier > "module".

Re: [Python-3000] Path Reform: Get the ball rolling

2006-11-01 Thread Greg Ewing
Mike Orr wrote: > P.stat().mtime and P.lstat().mtime look a lot better than P.mtime() > and P.lmtime() Another thing to consider is that stat() potentially lets you enquire about multiple attributes without making a system call for each one. -- Greg __

Re: [Python-3000] Draft PEP for outer scopes

2006-11-01 Thread Andrew McNamara
>Andrew McNamara wrote: >> But it doesn't mean "top-level" - it already comes with the qualifier >> "module". > >This is exactly what "global variable" means in C, Perl, JavaScript, >Ruby, etc. > >The global scope is the widest scope in which you can declare a variable. This is inaccurate at best.

Re: [Python-3000] Path Reform: Get the ball rolling

2006-11-01 Thread Greg Ewing
Michael Urman wrote: >> p = os.path.normpath( os.path.join( __file__, "../..", "lib" ) ) > > Shouldn't an example avoid using the path separator directly within a > string literal? And avoid using a platform-specific parent directory specifier: p = path.normpath(path.join(__file__, os.p

Re: [Python-3000] Alternatives to 'outer'

2006-11-01 Thread Greg Ewing
Jim Jewett wrote: > I'll suggest "reuse" > > reuse myoutvar But to me that sounds like you're shadowing myoutvar, which is completely the wrong idea. -- Greg ___ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listi

Re: [Python-3000] Draft PEP for outer scopes

2006-11-01 Thread Fredrik Lundh
Guido van Rossum wrote: >> > A shorthand form is also permitted, in which nonlocal is prepended to >> > an assignment or augmented assignment statement: >> > >> > nonlocal x = 3 >> >> Is a similar statement for globals legal in Py3k? It's not in 2.4 >> (according to my own testing) or 2.5

Re: [Python-3000] Path Reform: Get the ball rolling

2006-11-01 Thread Ronald Oussoren
On Nov 1, 2006, at 8:07 PM, Josiah Carlson wrote: Oleg Broytmann <[EMAIL PROTECTED]> wrote: On Wed, Nov 01, 2006 at 08:32:08AM -0800, Josiah Carlson wrote: p = path.normpath(path.join(__file__, os.pardir, os.pardir, "lib")) What operating systems that Python currently supports doesn't h

[Python-3000] Mini Path object

2006-11-01 Thread Mike Orr
Posted to python-dev and python-3000. Follow-ups to python-dev only please. On 10/31/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > here's mine; it's fully backwards compatible, can go right into 2.6, > and can be incrementally improved in future releases: > > 1) add a pathname wrapper to "