Re: Goto (Posting On Python-List Prohibited)

2018-01-01 Thread Chris Angelico
On Tue, Jan 2, 2018 at 9:11 AM, wrote: > On Monday, January 1, 2018 at 9:35:06 PM UTC, Chris Angelico wrote: >> On Tue, Jan 2, 2018 at 7:16 AM, Chris Green wrote: >> > Dennis Lee Bieber wrote: >> >> >> >> Well... "break" does bypass the rest of the block, but it

Re: Goto (Posting On Python-List Prohibited)

2018-01-01 Thread breamoreboy
On Monday, January 1, 2018 at 9:35:06 PM UTC, Chris Angelico wrote: > On Tue, Jan 2, 2018 at 7:16 AM, Chris Green wrote: > > Dennis Lee Bieber wrote: > >> > >> Well... "break" does bypass the rest of the block, but it still > >> exits > >> via the end of the block. I have a tendency to

Re: Goto (Posting On Python-List Prohibited)

2018-01-01 Thread Chris Angelico
On Tue, Jan 2, 2018 at 7:16 AM, Chris Green wrote: > Dennis Lee Bieber wrote: >> >> Well... "break" does bypass the rest of the block, but it still exits >> via the end of the block. I have a tendency to try for one "return" per >> procedure (so I'm

Re: Goto (Posting On Python-List Prohibited)

2018-01-01 Thread Chris Green
Dennis Lee Bieber wrote: > > Well... "break" does bypass the rest of the block, but it still exits > via the end of the block. I have a tendency to try for one "return" per > procedure (so I'm more likely to have an "if ...: break" then "if ...: > return"). I

Re: Goto (Posting On Python-List Prohibited)

2018-01-01 Thread John Q Hacker
Sorry, delete string "n't". I mean that you would strcuture your code with that architecture. Hate that. marxos On 1/1/18, John Q Hacker wrote: >>> I don’t use gotos in C code. Why should it be “harder” in a higher-level >>> language? >> >> Good for you. >> >> Looking at

Re: Goto (Posting On Python-List Prohibited)

2018-01-01 Thread John Q Hacker
>> I don’t use gotos in C code. Why should it be “harder” in a higher-level >> language? > > Good for you. > > Looking at 14 million lines of Linux kernel sources, which are in C, > over 100,000 of them use 'goto'. About one every 120 lines. Most use of goto's implies a lack of understanding of

Re: Goto (Posting On Python-List Prohibited)

2018-01-01 Thread From
(Posting On Python-List Prohibited) why ? -- https://mail.python.org/mailman/listinfo/python-list

Re: Goto (Posting On Python-List Prohibited)

2018-01-01 Thread bartc
On 01/01/2018 15:06, From wrote: (Posting On Python-List Prohibited) why ? Huh? I'm posting to the usenet group comp.lang.python (an off-topic reply to an off-topic remark, but it happens). I've no idea what the prohibited part is about, if that's what you're

Re: Goto (Posting On Python-List Prohibited)

2018-01-01 Thread bartc
On 01/01/2018 14:54, Peter J. Holzer wrote: On 2017-12-30 11:07:56 -0500, Dennis Lee Bieber wrote: Yes. I don't know any language which enforces "pure" structured programming. They all have some constructs (goto, break, return, exceptions, ...) to leave a block early. I don't think that

Re: Goto (Posting On Python-List Prohibited)

2018-01-01 Thread Peter J. Holzer
On 2017-12-30 11:07:56 -0500, Dennis Lee Bieber wrote: > On Sat, 30 Dec 2017 13:46:14 +0100, "Peter J. Holzer" > declaimed the following: > > >I don't think this is correct. Structured programming is much older: > >ALGOL 60 was already a block structured language and Dijkstra

Re: Goto (Posting On Python-List Prohibited)

2018-01-01 Thread breamoreboy
On Sunday, December 31, 2017 at 6:56:16 PM UTC, bartc wrote: > On 31/12/2017 17:01, breamoreboy wrote: > > >Further I've never once in 17 years of using Python been tearing my hair out > >over the lack of goto > > Neither have I over all the advanced features of Python I never use, and > for

Re: Goto (Posting On Python-List Prohibited)

2018-01-01 Thread bartc
On 01/01/2018 00:40, MRAB wrote: On 2017-12-31 23:21, bartc wrote: [Block delimiting] proc fn2(int a)= ... end (or possibly "inline f123="). [snip] OT: if "case ... esac" and "if ... fi", why not "proc ... corp"? :-) (I don't think Algol-68 used corp otherwise it might have been

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread bartc
On 31/12/2017 17:01, breamore...@gmail.com wrote: Further I've never once in 17 years of using Python been tearing my hair out over the lack of goto Neither have I over all the advanced features of Python I never use, and for double that number of years. Yet for some they will be as

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread mm0fmf
On 31/12/2017 17:01, breamore...@gmail.com wrote: I would use functions every time as a modern compiler can inline them This Further I've never once in 17 years of using Python been tearing my hair out over the lack of goto And this. (In my case only 6 years.) --

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread Ben Bacarisse
bartc writes: > On 31/12/2017 22:09, Ben Bacarisse wrote: > >> No, you missed the point and did not address the question. You said (now >> cut) >> >> | If I thought introducing functions, whether local or not, as a way of >> | avoiding goto was worth doing, I would do so. >> >>

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread MRAB
On 2017-12-31 23:21, bartc wrote: On 31/12/2017 22:09, Ben Bacarisse wrote: No, you missed the point and did not address the question. You said (now cut) | If I thought introducing functions, whether local or not, as a way of | avoiding goto was worth doing, I would do so. but I'm not sure

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread bartc
On 31/12/2017 22:09, Ben Bacarisse wrote: No, you missed the point and did not address the question. You said (now cut) | If I thought introducing functions, whether local or not, as a way of | avoiding goto was worth doing, I would do so. but I'm not sure you know if it's worth it or not.

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread Ben Bacarisse
bartc writes: > On 31/12/2017 15:02, Ben Bacarisse wrote: >> bartc writes: > >> I think there's a problem with that. Standard C does not have them, you >> said your language does not implement them properly > > (The real problem is I don't remember local

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread Chris Angelico
On Mon, Jan 1, 2018 at 6:29 AM, bartc wrote: > You'll need to give an example I think. Suppose I start with this: > > def fn(a): > if a==1: > print ("One") > print ("Two") > print ("Three") > elif a==2: > print ("Four") > else: >

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread bartc
On 31/12/2017 19:29, bartc wrote: [Ignore the original, incomplete version of my post, which appears after the sig. I decided to actually try it out for real instead of just guessing! Good thing too.] -- https://mail.python.org/mailman/listinfo/python-list

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread bartc
On 31/12/2017 17:06, Chris Angelico wrote: On Mon, Jan 1, 2018 at 3:55 AM, bartc wrote: The suggestion was to use them to avoid gotos. If duplicating is a good idea (and it's a hard line to draw) then we are not talking about the same cases. Given the choice of "dragging in

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread breamoreboy
On Sunday, December 31, 2017 at 3:02:41 PM UTC, Ben Bacarisse wrote: > bartc writes: > > > On 31/12/2017 12:41, Chris Angelico wrote: > >> On Sun, Dec 31, 2017 at 11:33 PM, bartc wrote: > >>> On 30/12/2017 23:54, Chris Angelico wrote: > > > I've written

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread Chris Angelico
On Mon, Jan 1, 2018 at 3:55 AM, bartc wrote: >> The suggestion was to use them to avoid gotos. If duplicating is a good >> idea (and it's a hard line to draw) then we are not talking about the >> same cases. Given the choice of "dragging in named functions" and >> dragging in

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread bartc
On 31/12/2017 15:02, Ben Bacarisse wrote: bartc writes: I think there's a problem with that. Standard C does not have them, you said your language does not implement them properly (The real problem is I don't remember local functions being used anywhere else. It's an

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread Ben Bacarisse
bartc writes: > On 31/12/2017 12:41, Chris Angelico wrote: >> On Sun, Dec 31, 2017 at 11:33 PM, bartc wrote: >>> On 30/12/2017 23:54, Chris Angelico wrote: > I've written code that uses dirty tricks like that to avoid duplication. It's at least as

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread bartc
On 31/12/2017 12:41, Chris Angelico wrote: On Sun, Dec 31, 2017 at 11:33 PM, bartc wrote: On 30/12/2017 23:54, Chris Angelico wrote: I've written code that uses dirty tricks like that to avoid duplication. It's at least as much of a problem as actual duplication is.

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread Chris Angelico
On Sun, Dec 31, 2017 at 11:33 PM, bartc wrote: > On 30/12/2017 23:54, Chris Angelico wrote: >> >> On Sun, Dec 31, 2017 at 10:45 AM, bartc wrote: >>> >>> On 30/12/2017 23:26, Gregory Ewing wrote: bartc wrote: > > > B and C occur twice,

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread bartc
On 30/12/2017 23:54, Chris Angelico wrote: On Sun, Dec 31, 2017 at 10:45 AM, bartc wrote: On 30/12/2017 23:26, Gregory Ewing wrote: bartc wrote: B and C occur twice, so a goto is a quick way to reuse B and C without needing to duplicate code, This only works if the

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread Ben Bacarisse
bartc writes: > On 30/12/2017 20:36, Ben Bacarisse wrote: >> bartc writes: >> >>> On 30/12/2017 16:53, mm0fmf wrote: On 30/12/2017 14:41, bartc wrote: > it looks a bit naff Understatement of 2017. >>> >>> I'm honest about my own ideas, but my

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread MRAB
On 2017-12-30 23:22, Gregory Ewing wrote: Stefan Ram wrote: BASIC has DEF FN... which /can/ define actual subroutines, limited to expressions. Now, what does this limitation remind me of? The equivalent limitation in Python is nowhere near as bad, since if you outgrow what lambda can

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread Chris Angelico
On Sun, Dec 31, 2017 at 10:45 AM, bartc wrote: > On 30/12/2017 23:26, Gregory Ewing wrote: >> >> bartc wrote: >>> >>> B and C occur twice, so a goto is a quick way to reuse B and C without >>> needing to duplicate code, >> >> >> This only works if the repeated part happens to be

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread bartc
On 30/12/2017 23:26, Gregory Ewing wrote: bartc wrote: B and C occur twice, so a goto is a quick way to reuse B and C without needing to duplicate code, This only works if the repeated part happens to be at the tail of each case. IME that seems to be the most common situation. Any other

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread Gregory Ewing
bartc wrote: B and C occur twice, so a goto is a quick way to reuse B and C without needing to duplicate code, This only works if the repeated part happens to be at the tail of each case. Any other situation and you're back to local functions. -- Greg --

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread Gregory Ewing
bartc wrote: C doesn't in general have local functions. My own languages don't implement them properly. So I tend not to use them. Looks like there's something circular going on here. You don't have much experience of using local functions, so you don't see a lot of value in them, so you

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread Gregory Ewing
Stefan Ram wrote: BASIC has DEF FN... which /can/ define actual subroutines, limited to expressions. Now, what does this limitation remind me of? The equivalent limitation in Python is nowhere near as bad, since if you outgrow what lambda can do you can always use a def instead. BASIC

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread Chris Angelico
On Sun, Dec 31, 2017 at 9:43 AM, bartc wrote: > On 30/12/2017 20:36, Ben Bacarisse wrote: >> >> bartc writes: >> >>> On 30/12/2017 16:53, mm0fmf wrote: On 30/12/2017 14:41, bartc wrote: > > it looks a bit naff Understatement of

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread bartc
On 30/12/2017 20:36, Ben Bacarisse wrote: bartc writes: On 30/12/2017 16:53, mm0fmf wrote: On 30/12/2017 14:41, bartc wrote: it looks a bit naff Understatement of 2017. I'm honest about my own ideas, but my remarks were about the use of special symbols such as "::" and

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread William Ray Wing
> On Dec 30, 2017, at 7:46 AM, Peter J. Holzer wrote: > > On 2017-12-29 19:09:35 -0500, Dennis Lee Bieber wrote: >> On Fri, 29 Dec 2017 23:12:22 +, bartc declaimed the >> following: >>> Looking at 14 million lines of Linux kernel sources, which are in C,

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread Chris Angelico
On Sun, Dec 31, 2017 at 7:36 AM, Ben Bacarisse wrote: > bartc writes: > >> On 30/12/2017 16:53, mm0fmf wrote: >>> On 30/12/2017 14:41, bartc wrote: it looks a bit naff >>> >>> Understatement of 2017. >> >> I'm honest about my own ideas, but my remarks

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread Ben Bacarisse
bartc writes: > On 30/12/2017 16:53, mm0fmf wrote: >> On 30/12/2017 14:41, bartc wrote: >>> it looks a bit naff >> >> Understatement of 2017. > > I'm honest about my own ideas, but my remarks were about the use of > special symbols such as "::" and "@". > > Before completely

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread Ian Kelly
On Sat, Dec 30, 2017 at 8:41 AM, bartc wrote: > (I had introduced a special language feature just for this kind of thing, > but it was unsatisfactory. Goto was simpler and understood by everyone. And > portable to any other language - that hasn't done away with goto. But it >

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread MRAB
On 2017-12-30 18:21, bartc wrote: On 30/12/2017 16:53, mm0fmf wrote: On 30/12/2017 14:41, bartc wrote: it looks a bit naff Understatement of 2017. I'm honest about my own ideas, but my remarks were about the use of special symbols such as "::" and "@". Before completely dismissing it

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread bartc
On 30/12/2017 16:53, mm0fmf wrote: On 30/12/2017 14:41, bartc wrote: it looks a bit naff Understatement of 2017. I'm honest about my own ideas, but my remarks were about the use of special symbols such as "::" and "@". Before completely dismissing it however, you should look at how

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread mm0fmf
On 30/12/2017 14:41, bartc wrote: it looks a bit naff Understatement of 2017. -- https://mail.python.org/mailman/listinfo/python-list

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread bartc
On 30/12/2017 03:05, Lawrence D’Oliveiro wrote: On Saturday, December 30, 2017 at 12:12:23 PM UTC+13, bartc wrote: Looking at 14 million lines of Linux kernel sources, which are in C, over 100,000 of them use 'goto'. About one every 120 lines. That kind of thing leads to spaghetti code. Here

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread Peter J. Holzer
On 2017-12-29 19:09:35 -0500, Dennis Lee Bieber wrote: > On Fri, 29 Dec 2017 23:12:22 +, bartc declaimed the > following: > >Looking at 14 million lines of Linux kernel sources, which are in C, > >over 100,000 of them use 'goto'. About one every 120 lines. > > > > C

Re: Goto (Posting On Python-List Prohibited)

2017-12-29 Thread Rustom Mody
On Saturday, December 30, 2017 at 8:35:27 AM UTC+5:30, Lawrence D’Oliveiro wrote: > On Saturday, December 30, 2017 at 12:12:23 PM UTC+13, bartc wrote: > > Looking at 14 million lines of Linux kernel sources, which are in C, > > over 100,000 of them use 'goto'. About one every 120 lines. > >

Re: Goto (Posting On Python-List Prohibited)

2017-12-29 Thread MRAB
On 2017-12-29 23:12, bartc wrote: On 29/12/2017 21:55, Lawrence D’Oliveiro wrote: On Saturday, December 30, 2017 at 9:03:50 AM UTC+13, bartc wrote: Why most newer, higher level languages don't, I don't know. Perhaps because the people who design them want to make programming harder? I don’t

Re: Goto (Posting On Python-List Prohibited)

2017-12-29 Thread Skip Montanaro
Looking at 14 million lines of Linux kernel sources, which are in C, over 100,000 of them use 'goto'. About one every 120 lines. Isn't C's goto statement restricted to the current function? I imagine setjmp and longjmp calls might be more insidious. Skip --

Re: Goto (Posting On Python-List Prohibited)

2017-12-29 Thread bartc
On 29/12/2017 21:55, Lawrence D’Oliveiro wrote: On Saturday, December 30, 2017 at 9:03:50 AM UTC+13, bartc wrote: Why most newer, higher level languages don't, I don't know. Perhaps because the people who design them want to make programming harder? I don’t use gotos in C code. Why should it