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

2006-11-02 Thread Ka-Ping Yee
On Fri, 3 Nov 2006, Greg Ewing wrote: > > Before it is reasonable to change the meaning of "global", we would > > need to have coherent answers to these questions: > > > > 1. What is the global namespace? > > Under the proposal, there is no such thing as > "the" global namespace, so the questi

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

2006-11-02 Thread Mike Orr
On 11/2/06, Talin <[EMAIL PROTECTED]> wrote: > One way to solve this would be to define a platform-neutral path > representation that can be "rendered" into either os-specific *or* > application-specific formats. I could read a Perforce path string, > convert that into an abstract path, do some wor

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

2006-11-02 Thread Talin
Greg Ewing wrote: > Talin wrote: >> And that includes path strings read from config files, not just path >> objects. > > This is something new. I hadn't realised anyone > was considering that to be within the scope of > any of the proposed path modules. > > Obviously this is going to require def

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

2006-11-02 Thread Talin
Greg Ewing wrote: > Ka-Ping Yee wrote: >> Before it is reasonable to change the meaning of "global", we would >> need to have coherent answers to these questions: >> >> 1. What is the global namespace? > > Under the proposal, there is no such thing as > "the" global namespace, so the question

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

2006-11-02 Thread Greg Ewing
Ka-Ping Yee wrote: > Before it is reasonable to change the meaning of "global", we would > need to have coherent answers to these questions: > > 1. What is the global namespace? Under the proposal, there is no such thing as "the" global namespace, so the question is meaningless. There's no

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

2006-11-02 Thread Greg Ewing
Talin wrote: > And that includes path strings read from config files, > not just path objects. This is something new. I hadn't realised anyone was considering that to be within the scope of any of the proposed path modules. Obviously this is going to require defining a standard external represen

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

2006-11-02 Thread Greg Ewing
Talin wrote: > Right now, you can create a global variable from within a scope, even if > that variable hasn't been declared yet: That doesn't seem like a good practice from a readability point of view to me, but in any case, there's no reason it couldn't continue to be supported: If you don't

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

2006-11-02 Thread Ka-Ping Yee
Before it is reasonable to change the meaning of "global", we would need to have coherent answers to these questions: 1. What is the global namespace? 2. Do global variables belong to the global namespace? 3. When it says "global x" does that mean x is a global variable? I think

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

2006-11-02 Thread Greg Ewing
Steven Bethard wrote: > 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"? > > I don't think that'll really be worth it. I'd be amazed if people > didn't expect it to mean "top-level". Anoth

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

2006-11-02 Thread Marcin 'Qrczak' Kowalczyk
Greg Ewing <[EMAIL PROTECTED]> writes: > In any case, if we all start writing code that makes assumptions > about pathname syntax, and some platform comes along in the future > that does things differently, we're hosed. Some conventions in the world are converging. For example a byte universally

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

2006-11-02 Thread Greg Ewing
Mike Orr wrote: > Perhaps this > disrecommendation should be lifted, especially since both Mac and > Windows do the right thing with "/", "..", and "." now. Is anyone still supporting VMS? It has a wildly different pathname syntax. In any case, if we all start writing code that makes assumptions

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

2006-11-02 Thread Josiah Carlson
"Delaney, Timothy (Tim)" <[EMAIL PROTECTED]> wrote: > If "global" were to change in Py3K to require an existing binding at the > time the "global" keyword was executed, this would then have the > semantics of "nonlocal" and be context-independent again. So I think any > proposal to reuse "global"

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

2006-11-02 Thread Delaney, Timothy (Tim)
Steven Bethard wrote: > 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() >>

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

2006-11-02 Thread Ka-Ping Yee
On Thu, 2 Nov 2006, Fredrik Lundh wrote: > Talin wrote: > > > If you change the behavior of 'global' to be the same as 'nonlocal' as > > has been proposed, then this effectively becomes impossible - you can no > > longer set any global that hasn't already been pre-declared. > > of course you can, a

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

2006-11-02 Thread Fredrik Lundh
Talin wrote: > If you change the behavior of 'global' to be the same as 'nonlocal' as > has been proposed, then this effectively becomes impossible - you can no > longer set any global that hasn't already been pre-declared. of course you can, as long as it isn't shadowed in an intermediate scop

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

2006-11-02 Thread Ronald Oussoren
On Nov 2, 2006, at 6:53 PM, Talin wrote: Ronald Oussoren wrote: On Nov 2, 2006, at 5:21 PM, Paul Moore wrote: On 11/1/06, Mike Orr <[EMAIL PROTECTED]> wrote: [...] especially since both Mac and Windows do the right thing with "/", "..", and "." now. Not always: D:\Data>dir C:/ Invalid s

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

2006-11-02 Thread Talin
Fredrik Lundh wrote: > Talin wrote: > >> One thing I don't understand in this discussion of re-purposing the >> 'global' keyword is how you handle the case of an inner function that >> *creates* a global. >> >> Right now, you can create a global variable from within a scope, even if >> that var

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

2006-11-02 Thread Talin
Ronald Oussoren wrote: > > On Nov 2, 2006, at 5:21 PM, Paul Moore wrote: > >> On 11/1/06, Mike Orr <[EMAIL PROTECTED]> wrote: >>> [...] especially since both Mac and >>> Windows do the right thing with "/", "..", and "." now. >> >> Not always: >> >> D:\Data>dir C:/ >> Invalid switch - "". > > An

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

2006-11-02 Thread Jan Grant
On Thu, 2 Nov 2006, Georg Brandl wrote: > > PS. If you're hunting for keywords to overload to drag variables into > > scope, > > "import" is also available, although would probably be very hard to make > > work. > > How should that possibly work? Without treading on the toes of the existing i

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

2006-11-02 Thread Ronald Oussoren
On Nov 2, 2006, at 5:21 PM, Paul Moore wrote: On 11/1/06, Mike Orr <[EMAIL PROTECTED]> wrote: [...] especially since both Mac and Windows do the right thing with "/", "..", and "." now. Not always: D:\Data>dir C:/ Invalid switch - "". And on Mac this depends on the API you use, if you use

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

2006-11-02 Thread Paul Moore
On 11/1/06, Mike Orr <[EMAIL PROTECTED]> wrote: > [...] especially since both Mac and > Windows do the right thing with "/", "..", and "." now. Not always: D:\Data>dir C:/ Invalid switch - "". Paul. ___ Python-3000 mailing list Python-3000@python.org h

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

2006-11-02 Thread Georg Brandl
Mike Orr wrote: > 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

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

2006-11-02 Thread Georg Brandl
Jan Grant wrote: > On Wed, 1 Nov 2006, 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". The real question is, if people >> see something like this:: >> >> def f(): >> n = 0 >> def g(i): >>

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

2006-11-02 Thread Antoine
> OTOH, having `global` and `nonlocal` mean the same thing for > module-bound variables violates TOOWTDI. Then you can disallow "nonlocal" for anything else than closure variables. And disallow "global" for anything else than module-global variables. It is explicit and unambiguous, and reduces th

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

2006-11-02 Thread Fredrik Lundh
Talin wrote: > One thing I don't understand in this discussion of re-purposing the > 'global' keyword is how you handle the case of an inner function that > *creates* a global. > > Right now, you can create a global variable from within a scope, even if > that variable hasn't been declared yet

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

2006-11-02 Thread Talin
Fredrik Lundh wrote: > 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". > > as anyone who's spent enough time on c.l.python knows, people expect it > to mean "application global". it isn't. > > alternatively,

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

2006-11-02 Thread Jan Grant
On Wed, 1 Nov 2006, 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". The real question is, if people > see something like this:: > > def f(): > n = 0 > def g(i): > global n >

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

2006-11-02 Thread Fredrik Lundh
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". as anyone who's spent enough time on c.l.python knows, people expect it to mean "application global". it isn't. alternatively, they expect it to be a scope specifi

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

2006-11-02 Thread Christian Tanzer
Ka-Ping Yee <[EMAIL PROTECTED]> wrote: > A shorthand form is also permitted, in which ``nonlocal`` is > prepended to an assignment or augmented assignment statement:: > > nonlocal x = 3 > > The above has exactly the same meaning as ``nonlocal x; x = 3``. Nice. > The shorthand form does not

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

2006-11-02 Thread Christian Tanzer
Ka-Ping Yee <[EMAIL PROTECTED]> wrote: > 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: > > S

Re: [Python-3000] Mini Path object

2006-11-02 Thread Paul Moore
On 11/2/06, Mike Orr <[EMAIL PROTECTED]> wrote: > Given the widely-diverging views on what, if anything, should be done > to os.path, how about we make a PEP and a standalone implementation of > (1) for now, and leave (2) and everything else for a later PEP. Why write a PEP at this stage? Just rel