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
Carl Banks wrote:
> Maybe look to see how tail-recursive optimization in languages such as
> Scheme work, and whether it can be generalized.
Thanks for the feedback - I should've remembered tail recursion.
> I doubt this would be possible without a major change in how functions
> work in Python.
This reminds me of an silly little optimization I used to use all the
times when coding in assembler on PIC MCUs.
A call followed by a return can be turned into jump. Saves one
instruction and one level on the call stack.
I think most optimizing compilers already do something of this sort, at
l
Michael wrote:
> Suppose we could do the same for a python function - suppose we could
> call the python function but either /without/ creating a new stack
> frame or /replacing/ the current stack frame with the new one.
I'm confused about what you mean. I'm guessing by "not creating a new
stack
Hi,
[ I'm calling this PEP thought experiment because I'm discussing language
ideas for python which if implemented would probably be quite powerful
and useful, but the increased risk of obfuscation when the ideas are
used outside my expected/desired problem domain probably massively
outw