Re: [Numpy-discussion] Python needs goto

2015-09-25 Thread Nathaniel Smith
On Fri, Sep 25, 2015 at 2:39 PM, Ryan May wrote: > > On Fri, Sep 25, 2015 at 3:02 PM, Nathaniel Smith wrote: >> >> The coroutines in 3.5 are just syntactic sugar around features that were >> added in *2*.5 (yield expressions and yield from), so no need to wait :-). >> They fall far short of arbit

Re: [Numpy-discussion] Python needs goto

2015-09-25 Thread Ryan May
On Fri, Sep 25, 2015 at 3:02 PM, Nathaniel Smith wrote: > > The coroutines in 3.5 are just syntactic sugar around features that were > added in *2*.5 (yield expressions and yield from), so no need to wait :-). > They fall far short of arbitrary continuations, though. > Correction: Python 3.4 gain

Re: [Numpy-discussion] Python needs goto

2015-09-25 Thread Nathaniel Smith
On Sep 25, 2015 11:06 AM, "Charles R Harris" wrote: > > > > On Fri, Sep 25, 2015 at 10:27 AM, Anne Archibald wrote: >> >> goto! and comefrom! Together with exceptions, threads, lambda, super, generators, and coroutines, all we're lacking is call-with-current-continuation for the full list of impe

Re: [Numpy-discussion] Python needs goto

2015-09-25 Thread Charles R Harris
On Fri, Sep 25, 2015 at 10:27 AM, Anne Archibald wrote: > goto! and comefrom! Together with exceptions, threads, lambda, super, > generators, and coroutines, all we're lacking is > call-with-current-continuation for the full list of impenetrable > control-flow constructs. Oh, and lisp-style resum

Re: [Numpy-discussion] Python needs goto

2015-09-25 Thread Benjamin Root
Ow! Ow! Ow! I am just a meteorologist that has an obsession with looking up unfamiliar technology terms. I need a Tylenol... Ben Root On Fri, Sep 25, 2015 at 12:27 PM, Anne Archibald wrote: > goto! and comefrom! Together with exceptions, threads, lambda, super, > generators, and coroutines, all

Re: [Numpy-discussion] Python needs goto

2015-09-25 Thread Anne Archibald
goto! and comefrom! Together with exceptions, threads, lambda, super, generators, and coroutines, all we're lacking is call-with-current-continuation for the full list of impenetrable control-flow constructs. Oh, and lisp-style resumable exception handling. (Suggested syntax: drop(exception, value)

Re: [Numpy-discussion] Python needs goto

2015-09-25 Thread William Ray Wing
> On Sep 25, 2015, at 1:53 AM, Alexander EberspÀcher > wrote: > > On 24.09.2015 21:12, Charles R Harris wrote: > >> I find Cleve Moler's old Fortran version of Brent's zero finding >> algorithm using gotos clearer than the structured versions you can find >> in Numerical Recipes. The operation

Re: [Numpy-discussion] Python needs goto

2015-09-25 Thread Christophe Bal
Very funny ! 😂 Le 25 sept. 2015 07:53, "Alexander EberspĂ€cher" a Ă©crit : > On 24.09.2015 21:12, Charles R Harris wrote: > > > I find Cleve Moler's old Fortran version of Brent's zero finding > > algorithm using gotos clearer than the structured versions you can find > > in Numerical Recipes. The

Re: [Numpy-discussion] Python needs goto

2015-09-24 Thread Alexander EberspÀcher
On 24.09.2015 21:12, Charles R Harris wrote: > I find Cleve Moler's old Fortran version of Brent's zero finding > algorithm using gotos clearer than the structured versions you can find > in Numerical Recipes. The operation of the algorithm is easiest to > describe as a finite state machine. I ne

Re: [Numpy-discussion] Python needs goto

2015-09-24 Thread Charles R Harris
On Thu, Sep 24, 2015 at 12:57 PM, Christophe Bal wrote: > By pseudo example, I mean pseudo code. > I find Cleve Moler's old Fortran version of Brent's zero finding algorithm using gotos clearer than the structured versions you can find in Numerical Recipes. The operation of the algorithm is easi

Re: [Numpy-discussion] Python needs goto

2015-09-24 Thread Christophe Bal
By pseudo example, I mean pseudo code. Le 24 sept. 2015 20:56, "Christophe Bal" a écrit : > To be honest, I am not very conviced. Does someone can give a pseudo > example ? > Le 24 sept. 2015 20:50, "Benjamin Root" a écrit : > >> Most of the time when I wanted to use goto in my early days, I fou

Re: [Numpy-discussion] Python needs goto

2015-09-24 Thread Christophe Bal
To be honest, I am not very conviced. Does someone can give a pseudo example ? Le 24 sept. 2015 20:50, "Benjamin Root" a écrit : > Most of the time when I wanted to use goto in my early days, I found that > breaks and continues were better and easier to understand. I will admit > that there are o

Re: [Numpy-discussion] Python needs goto

2015-09-24 Thread Benjamin Root
Most of the time when I wanted to use goto in my early days, I found that breaks and continues were better and easier to understand. I will admit that there are occasional nested if/elif/else code that get messy without a goto. But which smells worse? A "goto" package or a complex if/elif/else? Be

Re: [Numpy-discussion] Python needs goto

2015-09-24 Thread Charles R Harris
On Thu, Sep 24, 2015 at 12:13 PM, Yarko Tymciurak wrote: > > > On Thu, Sep 24, 2015 at 12:54 PM, Alexander EberspÀcher < > alex.eberspaec...@gmail.com> wrote: > >> On 24.09.2015 13:25, Christophe Bal wrote: >> >> > Can you give an example where GOTO is useful ? >> >> I think those pieces of code

Re: [Numpy-discussion] Python needs goto

2015-09-24 Thread Jason Newton
In my experience, it's also come up with finite-state-machines where there's lots of loops. You might consider something like a long-lived client-loop on some socket, where states like try-connect, connected, and while-connected-and-everythings-ok exist and each can have it's own never ending loop

Re: [Numpy-discussion] Python needs goto

2015-09-24 Thread Yarko Tymciurak
On Thu, Sep 24, 2015 at 12:54 PM, Alexander EberspÀcher < alex.eberspaec...@gmail.com> wrote: > On 24.09.2015 13:25, Christophe Bal wrote: > > > Can you give an example where GOTO is useful ? > > I think those pieces of code are best understood with some humour.. > > However, basically I can think

Re: [Numpy-discussion] Python needs goto

2015-09-24 Thread Alexander EberspÀcher
On 24.09.2015 13:25, Christophe Bal wrote: > Can you give an example where GOTO is useful ? I think those pieces of code are best understood with some humour.. However, basically I can think two main causes for using goto: 1. Stop whatever your code is doing and jump towards the end of the prog

Re: [Numpy-discussion] Python needs goto

2015-09-24 Thread R Schumacher
An older non-decorator implementation, with examples (slower) http://entrian.com/goto/ At 04:25 AM 9/24/2015, you wrote: Hello. Can you give an example where GOTO is useful ? Le 24 sept. 2015 07:24, "Charles R Harris" <charlesr.har...@gmail.com> a écritÂ

Re: [Numpy-discussion] Python needs goto

2015-09-24 Thread Christophe Bal
Hello. Can you give an example where GOTO is useful ? Le 24 sept. 2015 07:24, "Charles R Harris" a écrit : > At last, goto for python ! > > Usage: > > from goto import with_goto > > @with_goto > def range(start, stop): > i = start > result = [] > >

[Numpy-discussion] Python needs goto

2015-09-23 Thread Charles R Harris
At last, goto for python ! Usage: from goto import with_goto @with_goto def range(start, stop): i = start result = [] label .begin if i == stop: goto .end result.append(i) i += 1 goto .begin label .end return r