PEP thought experiment: Unix style exec for function/method calls
Carl Banks
invalidemail at aerojockey.com
Sun Jul 2 11:24:12 EDT 2006
Michael wrote:
> > > def set_name():
> > > name = raw_input("Enter your name! > ")
> > > cexe greet()
> > >
> > > def greet():
> > > print "hello", name
> > >
> > > cexe set_name()
> > > print "We don't reach here"
> > > ----------
> > >
> > > This would execute, ask for the user's name, say hello to them and then
> > > exit - not reaching the final print "We don't reach here" statement.
> >
> > Only if you were to replace the whole stack. If you only replace or
> > reuse the top frame, I would think greet would exit and execution would
> > resume right after the point from which set_name was called. Or am I
> > misunderstanding what you want?
>
> I think you are.
[snip]
I'm sorry; I didn't notice the use of cexe also on the call to
set_name. So now it makes sense.
Carl Banks
More information about the Python-list
mailing list