[Python-Dev] PEP 3000 and exec

2005-10-17 Thread Jim Jewett
For communicating with an exec/eval child, once exec cannot run in the current namespace, I asked that it be possible to pass a read-only "current view" and to see a return value. (Guido): >... it's probably better to create an empty namespace and > explicitly copy into it ... > ... just pick cer

Re: [Python-Dev] PEP 3000 and exec

2005-10-17 Thread Guido van Rossum
On 10/17/05, Jim Jewett <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > > Another idea might be to change the exec() spec so that you are > > required to pass in a namespace (and you can't use locals() either!). > > Then the whole point becomes moot. > > I think of exec as having two major

[Python-Dev] PEP 3000 and exec

2005-10-17 Thread Jim Jewett
Guido van Rossum wrote: > Another idea might be to change the exec() spec so that you are > required to pass in a namespace (and you can't use locals() either!). > Then the whole point becomes moot. I think of exec as having two major uses: (1) A run-time compiler (2) A way to change the local

[Python-Dev] PEP 3000 and exec

2005-10-13 Thread Sokolov Yura
Agree. >>>i=1 >>>def a(): i=2 def b(): print i return b >>>a()() 2 >>>def a(): i=2 def b(): exec "print i" return b >>>a()() 1 ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org

Re: [Python-Dev] PEP 3000 and exec

2005-10-11 Thread Nick Coghlan
Guido van Rossum wrote: > My idea was to make the compiler smarter so that it would recognize > exec() even if it was just a function. > > Another idea might be to change the exec() spec so that you are > required to pass in a namespace (and you can't use locals() either!). > Then the whole point

Re: [Python-Dev] PEP 3000 and exec

2005-10-10 Thread Brett Cannon
On 10/10/05, Greg Ewing <[EMAIL PROTECTED]> wrote: > Brett Cannon wrote: > > > But the better answer is we will just find a way. =) > > I think the best answer would be just to dump the idea of > exec-in-local-namespace altogether. I don't think I've > ever seen a use case for it that wasn't bette

Re: [Python-Dev] PEP 3000 and exec

2005-10-10 Thread Greg Ewing
Brett Cannon wrote: > But the better answer is we will just find a way. =) I think the best answer would be just to dump the idea of exec-in-local-namespace altogether. I don't think I've ever seen a use case for it that wasn't better done some other way. Most often it seems to be used to answe

Re: [Python-Dev] PEP 3000 and exec

2005-10-10 Thread Christopher Armstrong
On 10/11/05, Guido van Rossum <[EMAIL PROTECTED]> wrote: > My idea was to make the compiler smarter so that it would recognize > exec() even if it was just a function. > > Another idea might be to change the exec() spec so that you are > required to pass in a namespace (and you can't use locals() e

Re: [Python-Dev] PEP 3000 and exec

2005-10-10 Thread Brett Cannon
On 10/10/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >> This might be minor-- but I didn't see anyone mentioning it so far. > >> If `exec` functionality is to be provided, then I think it still > >> should be a keyword for the parser to know; currently bytecode > >> generatio

Re: [Python-Dev] PEP 3000 and exec

2005-10-10 Thread Guido van Rossum
My idea was to make the compiler smarter so that it would recognize exec() even if it was just a function. Another idea might be to change the exec() spec so that you are required to pass in a namespace (and you can't use locals() either!). Then the whole point becomes moot. On 10/10/05, [EMAIL P

Re: [Python-Dev] PEP 3000 and exec

2005-10-10 Thread skip
>> This might be minor-- but I didn't see anyone mentioning it so far. >> If `exec` functionality is to be provided, then I think it still >> should be a keyword for the parser to know; currently bytecode >> generation is affected if `exec` is present. Even if that changes >> f

Re: [Python-Dev] PEP 3000 and exec

2005-10-10 Thread Brett Cannon
On 10/10/05, Christos Georgiou <[EMAIL PROTECTED]> wrote: > This might be minor-- but I didn't see anyone mentioning it so far. If > `exec` functionality is to be provided, then I think it still should be a > keyword for the parser to know; currently bytecode generation is affected if > `exec` is

[Python-Dev] PEP 3000 and exec

2005-10-10 Thread Christos Georgiou
This might be minor-- but I didn't see anyone mentioning it so far. If `exec` functionality is to be provided, then I think it still should be a keyword for the parser to know; currently bytecode generation is affected if `exec` is present. Even if that changes for Python 3k (we don't know yet