Re: Proposed keyword to transfer control to another function

2015-07-21 Thread Chris Angelico
On Wed, Jul 22, 2015 at 3:33 AM, Antoon Pardon wrote: > On 07/19/2015 02:21 AM, Chris Angelico wrote: >> On Sun, Jul 19, 2015 at 9:32 AM, Gregory Ewing >> wrote: > >>> Personally I'd be fine with your initial syntax, but >>> something else might be needed to get it past Guido. >>> He didn't like

Re: Proposed keyword to transfer control to another function

2015-07-21 Thread Antoon Pardon
On 07/19/2015 02:21 AM, Chris Angelico wrote: > On Sun, Jul 19, 2015 at 9:32 AM, Gregory Ewing > wrote: >> Personally I'd be fine with your initial syntax, but >> something else might be needed to get it past Guido. >> He didn't like my 'cocall f()' construct in PEP 3152, >> which is syntacticall

Re: Proposed keyword to transfer control to another function

2015-07-19 Thread Chris Angelico
On Mon, Jul 20, 2015 at 2:41 AM, Mark Lawrence wrote: > On 19/07/2015 17:24, MRAB wrote: >> >> On 2015-07-19 17:13, Chris Angelico wrote: >>> >>> On Mon, Jul 20, 2015 at 2:05 AM, Dennis Lee Bieber >>> wrote: I've only seen one other application using HHMLL -- and that was t

Re: Proposed keyword to transfer control to another function

2015-07-19 Thread Mark Lawrence
On 19/07/2015 17:24, MRAB wrote: On 2015-07-19 17:13, Chris Angelico wrote: On Mon, Jul 20, 2015 at 2:05 AM, Dennis Lee Bieber wrote: I've only seen one other application using HHMLL -- and that was the Amiga file system. Okay, I'll bite. What does HHMLL stand for? Google didn't answ

Re: Proposed keyword to transfer control to another function

2015-07-19 Thread Chris Angelico
On Mon, Jul 20, 2015 at 2:24 AM, MRAB wrote: > On 2015-07-19 17:13, Chris Angelico wrote: >> >> On Mon, Jul 20, 2015 at 2:05 AM, Dennis Lee Bieber >> wrote: >>> >>> I've only seen one other application using HHMLL -- and that was >>> the >>> Amiga file system. >> >> >> Okay, I'll bite. Wh

Re: Proposed keyword to transfer control to another function

2015-07-19 Thread MRAB
On 2015-07-19 17:13, Chris Angelico wrote: On Mon, Jul 20, 2015 at 2:05 AM, Dennis Lee Bieber wrote: I've only seen one other application using HHMLL -- and that was the Amiga file system. Okay, I'll bite. What does HHMLL stand for? Google didn't answer my question instantly with the

Re: Proposed keyword to transfer control to another function

2015-07-19 Thread Chris Angelico
On Mon, Jul 20, 2015 at 2:05 AM, Dennis Lee Bieber wrote: > I've only seen one other application using HHMLL -- and that was the > Amiga file system. Okay, I'll bite. What does HHMLL stand for? Google didn't answer my question instantly with the first result, like it usually does. I even

Re: Proposed keyword to transfer control to another function

2015-07-18 Thread Rustom Mody
On Saturday, July 18, 2015 at 9:18:32 AM UTC+5:30, Serhiy Storchaka wrote: > On 17.07.15 02:46, Chris Angelico wrote: > > Out of the lengthy thread on tail call optimization has come one broad > > theory that might be of interest, so I'm spinning it off into its own > > thread. > > > > The concept

Re: Proposed keyword to transfer control to another function

2015-07-18 Thread Chris Angelico
On Sun, Jul 19, 2015 at 9:32 AM, Gregory Ewing wrote: > Chris Angelico wrote: >> >> Possible alternate syntax: >> >> transfer func[, (arg1, arg2, arg3)[, {'kw1': val1, 'kw2': val2}]] >> >> This makes it very clear that this is NOT accepting an arbitrary >> expression, but MUST be used with a singl

Re: Proposed keyword to transfer control to another function

2015-07-18 Thread Gregory Ewing
Chris Angelico wrote: Possible alternate syntax: transfer func[, (arg1, arg2, arg3)[, {'kw1': val1, 'kw2': val2}]] This makes it very clear that this is NOT accepting an arbitrary expression, but MUST be used with a single function and its arguments. Downside: It doesn't look like a function ca

Re: Proposed keyword to transfer control to another function

2015-07-17 Thread Serhiy Storchaka
On 17.07.15 02:46, Chris Angelico wrote: Out of the lengthy thread on tail call optimization has come one broad theory that might be of interest, so I'm spinning it off into its own thread. The concept is like the Unix exec[vlpe] family of functions: replace the current stack frame with a new on

Re: Proposed keyword to transfer control to another function

2015-07-17 Thread Paul Rubin
Chris Angelico writes: > # derived from Paul Rubin's example > def quicksort(array, start, end): > midp = partition(array, start, end) Heh, forgot to include the base case, as someone pointed out. Oh well, it's pseudocode, or something. > transfer quicksort(array, midp+1, end) Ove

Re: Proposed keyword to transfer control to another function

2015-07-17 Thread Cameron Simpson
On 17Jul2015 20:43, Chris Angelico wrote: On Fri, Jul 17, 2015 at 5:17 PM, Antoon Pardon wrote: On 07/17/2015 01:46 AM, Chris Angelico wrote: Open for bikeshedding: What should the keyword be? We can't use "exec", which would match Unix and shell usage, because it's already used in a rather d

Re: Proposed keyword to transfer control to another function

2015-07-17 Thread Ethan Furman
On 07/17/2015 12:17 AM, Antoon Pardon wrote: On 07/17/2015 01:46 AM, Chris Angelico wrote: Open for bikeshedding: What should the keyword be? We can't use "exec", which would match Unix and shell usage, because it's already used in a rather different sense in Python. Current candidates: "transfe

Re: Proposed keyword to transfer control to another function

2015-07-17 Thread sohcahtoa82
On Friday, July 17, 2015 at 12:17:55 AM UTC-7, Antoon Pardon wrote: > On 07/17/2015 01:46 AM, Chris Angelico wrote: > > Open for bikeshedding: What should the keyword be? We can't use > > "exec", which would match Unix and shell usage, because it's already > > used in a rather different sense in Py

Re: Proposed keyword to transfer control to another function

2015-07-17 Thread Chris Angelico
On Fri, Jul 17, 2015 at 5:17 PM, Antoon Pardon wrote: > On 07/17/2015 01:46 AM, Chris Angelico wrote: >> Open for bikeshedding: What should the keyword be? We can't use >> "exec", which would match Unix and shell usage, because it's already >> used in a rather different sense in Python. Current ca

Re: Proposed keyword to transfer control to another function

2015-07-17 Thread Terry Reedy
On 7/17/2015 3:17 AM, Antoon Pardon wrote: On 07/17/2015 01:46 AM, Chris Angelico wrote: Open for bikeshedding: What should the keyword be? We can't use "exec", which would match Unix and shell usage, because it's already used in a rather different sense in Python. Current candidates: "transfer"

Re: Proposed keyword to transfer control to another function

2015-07-17 Thread Antoon Pardon
On 07/17/2015 01:46 AM, Chris Angelico wrote: > Open for bikeshedding: What should the keyword be? We can't use > "exec", which would match Unix and shell usage, because it's already > used in a rather different sense in Python. Current candidates: > "transfer", "goto", "recurse", and anything else

Re: Proposed keyword to transfer control to another function

2015-07-16 Thread Ethan Furman
On 07/16/2015 04:46 PM, Chris Angelico wrote: Examples: # derived from Paul Rubin's example def quicksort(array, start, end): midp = partition(array, start, end) if midp <= (start+end)//2: quicksort(array, start, midp) transfer quicksort(array, midp+1, end) e

Proposed keyword to transfer control to another function

2015-07-16 Thread Chris Angelico
Out of the lengthy thread on tail call optimization has come one broad theory that might be of interest, so I'm spinning it off into its own thread. The concept is like the Unix exec[vlpe] family of functions: replace the current stack frame with a new one. This can be used for explicit tail recur