Re: "Goto" statement in Python

2017-04-16 Thread Chris Angelico
On Sun, Apr 16, 2017 at 5:21 PM, Mikhail V wrote: > I am in the category "I just want to express some > algorithm and don't want to learn every year new concepts". > I tend to think that extremely restricted syntax, in the sence > of having only few flow control instructions

Re: "Goto" statement in Python

2017-04-16 Thread Mikhail V
On 14 April 2017 at 03:44, Steve D'Aprano wrote: > On Fri, 14 Apr 2017 12:52 am, bartc wrote: > >> I know this isn't the Python need-for-speed thread, but this is a >> classic example where the lack of one simple feature leads to using >> slower, more cumbersome ones.

Re: "Goto" statement in Python

2017-04-14 Thread Rob Gaddi
On 04/14/2017 07:19 AM, Dennis Lee Bieber wrote: On Fri, 14 Apr 2017 11:44:59 +1000, Steve D'Aprano declaimed the following: Even that's not enough for some. Donald Knuth, who supports the use of GOTO under some circumstances, maintains that any program using

Re: "Goto" statement in Python

2017-04-14 Thread Chris Angelico
On Sat, Apr 15, 2017 at 12:13 AM, Dennis Lee Bieber wrote: > On Thu, 13 Apr 2017 18:36:57 -0600, Ian Kelly > declaimed the following: > >> >>Well, you can do it in Assembly. And BASIC, if you count the primitive >>GOSUB-type subroutines, though

Re: "Goto" statement in Python

2017-04-14 Thread Chris Green
Bernd Nawothnig wrote: > On 2017-04-13, Mikhail V wrote: > > On 13 April 2017 at 18:48, Ian Kelly wrote: > >> On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V wrote: > >>> Now I wonder, have we already collected *all* bells

Re: "Goto" statement in Python

2017-04-14 Thread Bernd Nawothnig
On 2017-04-13, Grant Edwards wrote: > On 2017-04-13, Rob Gaddi wrote: > >> No, C doesn't support exception handling. As a result, handling error >> conditions in C is a huge pain for which (forward-only) goto is often, >> while not the only remedy, the least

Re: "Goto" statement in Python

2017-04-14 Thread Bernd Nawothnig
On 2017-04-13, Mikhail V wrote: > On 13 April 2017 at 18:48, Ian Kelly wrote: >> On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V wrote: >>> Now I wonder, have we already collected *all* bells and whistles of Python >>> in these two examples, or is there

Re: "Goto" statement in Python

2017-04-14 Thread bartc
On 14/04/2017 02:44, Steve D'Aprano wrote: On Fri, 14 Apr 2017 12:52 am, bartc wrote: I know this isn't the Python need-for-speed thread, but this is a classic example where the lack of one simple feature leads to using slower, more cumbersome ones. Dear gods, have I fallen back in time to

Re: "Goto" statement in Python

2017-04-13 Thread Rustom Mody
On Friday, April 14, 2017 at 7:15:11 AM UTC+5:30, Steve D'Aprano wrote: > On Fri, 14 Apr 2017 12:52 am, bartc wrote: > > > I know this isn't the Python need-for-speed thread, but this is a > > classic example where the lack of one simple feature leads to using > > slower, more cumbersome ones. >

Re: "Goto" statement in Python

2017-04-13 Thread Steve D'Aprano
On Fri, 14 Apr 2017 12:52 am, bartc wrote: > I know this isn't the Python need-for-speed thread, but this is a > classic example where the lack of one simple feature leads to using > slower, more cumbersome ones. Dear gods, have I fallen back in time to 1975 again? The Goto Wars are over, and

Re: "Goto" statement in Python

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 4:59 PM, bartc wrote: > On 13/04/2017 22:58, Ian Kelly wrote: >> >> On Thu, Apr 13, 2017 at 3:27 PM, Dennis Lee Bieber >> wrote: >>> >>> On Thu, 13 Apr 2017 15:52:24 +0100, bartc declaimed the >>> following: >>>

Re: "Goto" statement in Python

2017-04-13 Thread bartc
On 13/04/2017 22:58, Ian Kelly wrote: On Thu, Apr 13, 2017 at 3:27 PM, Dennis Lee Bieber wrote: On Thu, 13 Apr 2017 15:52:24 +0100, bartc declaimed the following: 'goto' would be one easy-to-execute byte-code; no variables, objects or types to worry

Re: "Goto" statement in Python

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 3:27 PM, Dennis Lee Bieber wrote: > On Thu, 13 Apr 2017 15:52:24 +0100, bartc declaimed the > following: > >>'goto' would be one easy-to-execute byte-code; no variables, objects or >>types to worry about. If implemented properly

Re: "Goto" statement in Python

2017-04-13 Thread Marko Rauhamaa
Rob Gaddi : > On 04/13/2017 08:26 AM, Marko Rauhamaa wrote: >> I have occasionally felt the urge to try "goto" in my C code, but having >> written it, I have taken it out. It just doesn't make the code look more >> elegant or robust. Unlike "break" or "return,"

Re: "Goto" statement in Python

2017-04-13 Thread Grant Edwards
On 2017-04-13, Rob Gaddi wrote: > No, C doesn't support exception handling. As a result, handling error > conditions in C is a huge pain for which (forward-only) goto is often, > while not the only remedy, the least painful one. Indeed. That is almost the

Re: "Goto" statement in Python

2017-04-13 Thread Mikhail V
On 13 April 2017 at 19:38, Ian Kelly wrote: > On Thu, Apr 13, 2017 at 11:25 AM, Mikhail V wrote: >> On 13 April 2017 at 18:48, Ian Kelly wrote: >>> On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V wrote:

Re: "Goto" statement in Python

2017-04-13 Thread Rustom Mody
On Thursday, April 13, 2017 at 11:19:38 PM UTC+5:30, Ian wrote: > On Thu, Apr 13, 2017 at 11:39 AM, Rustom Mody wrote: > > My broader point (vive la Trump) was that if we learn to actively tolerate > > people with views wildly far from ours, the world would be a better place. > > I fail to see

Re: "Goto" statement in Python

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 11:39 AM, Rustom Mody wrote: > My broader point (vive la Trump) was that if we learn to actively tolerate > people with views wildly far from ours, the world would be a better place. I fail to see how my comment "Functions and exceptions are

Re: "Goto" statement in Python

2017-04-13 Thread Rob Gaddi
On 04/13/2017 08:26 AM, Marko Rauhamaa wrote: Chris Angelico : Personally, I can't remember the last time I yearned for "goto" in Python, and the only times I've ever wished for it or used it in other languages have been multi-loop breaks or "for...else" blocks. And neither

Re: "Goto" statement in Python

2017-04-13 Thread Rustom Mody
On Thursday, April 13, 2017 at 10:56:53 PM UTC+5:30, Rob Gaddi wrote: > On 04/13/2017 10:13 AM, Rustom Mody wrote: > > On Thursday, April 13, 2017 at 10:19:33 PM UTC+5:30, Ian wrote: > >> On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V wrote: > >>> Now I wonder, have we already collected *all* bells

Re: "Goto" statement in Python

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 11:25 AM, Mikhail V wrote: > On 13 April 2017 at 18:48, Ian Kelly wrote: >> On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V wrote: >>> Now I wonder, have we already collected *all* bells and whistles of

Re: "Goto" statement in Python

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 11:13 AM, Rustom Mody wrote: > What to do?? > Ask Trump? > [I guess we now need a Godwin 2.0 with :s/Hitler/Trump ] Not even close. Whatever one's opinion may be of Trump, he hasn't murdered millions of people. --

Re: "Goto" statement in Python

2017-04-13 Thread Rob Gaddi
On 04/13/2017 10:13 AM, Rustom Mody wrote: On Thursday, April 13, 2017 at 10:19:33 PM UTC+5:30, Ian wrote: On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V wrote: Now I wonder, have we already collected *all* bells and whistles of Python in these two examples, or is there something else for

Re: "Goto" statement in Python

2017-04-13 Thread Thomas Nyberg
On 04/12/2017 04:42 PM, Mikhail V wrote: > For me it looks clear and I'd say easy to comprehend, > Main critic would be obviously that it is not > a good, *scalable application*, but quite often I don't > even have this in mind, and just want to express a > step-by-step direct instructions. I

Re: "Goto" statement in Python

2017-04-13 Thread Mikhail V
On 13 April 2017 at 18:48, Ian Kelly wrote: > On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V wrote: >> Now I wonder, have we already collected *all* bells and whistles of Python >> in these two examples, or is there something else for expressing trivial

Re: "Goto" statement in Python

2017-04-13 Thread bartc
On 13/04/2017 16:03, Ian Kelly wrote: On Thu, Apr 13, 2017 at 8:52 AM, bartc wrote: On 13/04/2017 15:35, Chris Angelico wrote: Personally, I can't remember the last time I yearned for "goto" in Python, and the only times I've ever wished for it or used it in other languages

Re: "Goto" statement in Python

2017-04-13 Thread Rustom Mody
On Thursday, April 13, 2017 at 10:19:33 PM UTC+5:30, Ian wrote: > On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V wrote: > > Now I wonder, have we already collected *all* bells and whistles of Python > > in these two examples, or is there something else for expressing trivial > > thing. > >

Re: "Goto" statement in Python

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V wrote: > Now I wonder, have we already collected *all* bells and whistles of Python > in these two examples, or is there something else for expressing trivial > thing. Functions and exceptions are considered "bells and whistles"?

Re: "Goto" statement in Python

2017-04-13 Thread Mikhail V
On 13 April 2017 at 02:17, Rob Gaddi wrote: > > def finder: > for s in S: > if s == 'i': > return 'found on stage 1' > > S = S + ' hello world' > for s in S: > if s == 'd': > return 'found on stage 2' > > raise ValueError('not found;

Re: "Goto" statement in Python

2017-04-13 Thread Marko Rauhamaa
Chris Angelico : > Personally, I can't remember the last time I yearned for "goto" in > Python, and the only times I've ever wished for it or used it in other > languages have been multi-loop breaks or "for...else" blocks. And > neither is very frequent. I have occasionally

Re: "Goto" statement in Python

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 8:52 AM, bartc wrote: > On 13/04/2017 15:35, Chris Angelico wrote: >> Personally, I can't remember the last time I yearned for "goto" in >> Python, and the only times I've ever wished for it or used it in other >> languages have been multi-loop breaks or

Re: "Goto" statement in Python

2017-04-13 Thread bartc
On 13/04/2017 15:35, Chris Angelico wrote: On Thu, Apr 13, 2017 at 9:31 PM, alister wrote: I expect you could simulate most of these with a custom exception for example break from nested loop: class GoTo(Exception): pass try: for i in range(100):

Re: "Goto" statement in Python

2017-04-13 Thread Chris Angelico
On Thu, Apr 13, 2017 at 9:31 PM, alister wrote: > I expect you could simulate most of these with a custom exception > for example break from nested loop: > > class GoTo(Exception): > pass > > try: > for i in range(100): > print i > for j in range

Re: "Goto" statement in Python

2017-04-13 Thread alister
On Thu, 13 Apr 2017 01:42:01 +0200, Mikhail V wrote: > On 12 April 2017 at 02:44, Nathan Ernst wrote: >> goto is a misunderstood and much misaligned creature. It is a very >> useful feature, but like nearly any programming construct can be >> abused. >> >> Constructs like

Re: "Goto" statement in Python

2017-04-12 Thread Rob Gaddi
On 04/12/2017 04:42 PM, Mikhail V wrote: On 12 April 2017 at 02:44, Nathan Ernst wrote: goto is a misunderstood and much misaligned creature. It is a very useful feature, but like nearly any programming construct can be abused. Constructs like 'break', 'continue' or

"Goto" statement in Python

2017-04-12 Thread Mikhail V
On 12 April 2017 at 02:44, Nathan Ernst wrote: > goto is a misunderstood and much misaligned creature. It is a very useful > feature, but like nearly any programming construct can be abused. > > Constructs like 'break', 'continue' or 'next' in languages like Python or >