Re: [Python-3000] The meaning of "global variable"

2006-11-05 Thread Georg Brandl
Ron Adam wrote: > I presume you meant: > > def f(): > x = 42 > def g(): > def h(): > parent x > x = 88 > > > The x would be a new local x in function g and have no effect on the x in > function f. Parent would do exactly what it means in this case,

Re: [Python-3000] The meaning of "global variable"

2006-11-05 Thread Ron Adam
Georg Brandl wrote: > Ron Adam wrote: > >> I presume you meant: >> >> def f(): >> x = 42 >> def g(): >> def h(): >> parent x >> x = 88 >> >> >> The x would be a new local x in function g and have no effect on the x in >> function f. Parent would do exa

Re: [Python-3000] The meaning of "global variable"

2006-11-05 Thread Marcin 'Qrczak' Kowalczyk
Ron Adam <[EMAIL PROTECTED]> writes: > By not limiting parent to just the parent scope you create exceptions. The > rule > becomes: > > The keyword (*)nonlocal designates a name will be written to in the > closest enclosing "parent" scope *except* when a pre-existing matching > name

Re: [Python-3000] The meaning of "global variable"

2006-11-05 Thread Mike Krell
> The rule should be: > > The keyword 'nonlocal' causes the lookup to be performed as if there > were no assignments to that variable in the scope containing the > 'nonlocal' declaration. > > No exceptions are needed, and no limitation to the immediately > surrounding scope is needed. Read accesses

Re: [Python-3000] The meaning of "global variable"

2006-11-05 Thread Georg Brandl
Marcin 'Qrczak' Kowalczyk wrote: > Ron Adam <[EMAIL PROTECTED]> writes: > >> By not limiting parent to just the parent scope you create exceptions. The >> rule >> becomes: >> >> The keyword (*)nonlocal designates a name will be written to in the >> closest enclosing "parent" scope *ex

Re: [Python-3000] Mini Path object

2006-11-05 Thread Greg Ewing
Mike Orr wrote: > .abspath() > .normpath() > .realpath() > .splitpath() > .relpath() > .relpathto() Seeing as the whole class is about paths, having "path" in the method names seems redundant. I'd prefer to see terser method names without any noise characters in them. --

[Python-3000] Backward compatibility for "nonlocal"

2006-11-05 Thread Ka-Ping Yee
As an aside to the discussion about "nonlocal", here are a couple of thoughts on backward compatibility. For some of the proposed keywords, here's the number of occurrences of the keyword in the current standard library (not including comments and docstrings): nonlocal 0 0 use

Re: [Python-3000] The meaning of "global variable"

2006-11-05 Thread Greg Ewing
Mike Krell wrote: > This is also why I advocate the spelling "use", because > ISTM "use x" pretty much means exactly what it says. I beg to differ -- it means nothing at all to me. At least "global" or "nonlocal" sound like they have *something* to do with scope, even if it's not clear exactly wh

Re: [Python-3000] Backward compatibility for "nonlocal"

2006-11-05 Thread Ka-Ping Yee
On Sun, 5 Nov 2006, Ka-Ping Yee wrote: > nonlocal 0 0 > use 2 2 > using 3 3 > reuse 0 4 > free 8 8 > outer 5 147 > global 126 214 Oops, i forgot to explain: the first column is th

Re: [Python-3000] Mini Path object

2006-11-05 Thread Ron Adam
Mike Orr wrote: > The multi-argument constructor is a replacement for joining paths. > (The PEP says .joinpath was "problematic" without saying why.)This > could theoretically go either way, doing either the same thing as > os.path.join, getting a little smarter, or doing "safe" joins by > dis

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

2006-11-05 Thread Andrew McNamara
>Python, C/C++, JavaScript, Ruby, and Perl all have this in common: > >A "global variable" is visible to the entire file and does >not belong to any particular function. I note that you didn't say "a global variable is visible to the entire application" - you've deliberately narrowed the d

Re: [Python-3000] The meaning of "global variable"

2006-11-05 Thread Neil Toronto
Greg Ewing wrote: >Mike Krell wrote: > > >> This is also why I advocate the spelling "use", because >>ISTM "use x" pretty much means exactly what it says. >> >> > >I beg to differ -- it means nothing at all to >me. At least "global" or "nonlocal" sound like >they have *something* to do with

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

2006-11-05 Thread Ka-Ping Yee
On Mon, 6 Nov 2006, Andrew McNamara wrote: > >Python, C/C++, JavaScript, Ruby, and Perl all have this in common: > > > >A "global variable" is visible to the entire file and does > >not belong to any particular function. > > I note that you didn't say "a global variable is visible to the en

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

2006-11-05 Thread Ka-Ping Yee
On Sat, 4 Nov 2006, Nick Coghlan wrote: > Count me as another +1 on disallowing the shorthand version. > > Rationale: > 1. We've lived without it in the case of global > 2. We can add it later if we decide we really need it, but if we > start with it and it turns out to be confusing or error-prone,

Re: [Python-3000] Mini Path object

2006-11-05 Thread Talin
Mike Orr wrote: > Posted to python-dev and python-3000. Follow-ups to python-dev only please. > > So, let's say we strip this Path class to: I'm finally taking the time to sit down and go over this in detail. Here are some suggestions. > class Path(unicode): > Path("foo") > Path( Path