Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-08 Thread Ian Kelly
On Wed, Nov 8, 2017 at 11:34 AM, Chris Angelico wrote: > On Thu, Nov 9, 2017 at 5:20 AM, Ian Kelly wrote: >> On Wed, Nov 8, 2017 at 11:12 AM, Chris Angelico wrote: >>> Except that "yield from" is used by generators to delegate to other >>> generators, and "await" is used by coroutines to delegat

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-08 Thread Chris Angelico
On Thu, Nov 9, 2017 at 5:20 AM, Ian Kelly wrote: > On Wed, Nov 8, 2017 at 11:12 AM, Chris Angelico wrote: >> Except that "yield from" is used by generators to delegate to other >> generators, and "await" is used by coroutines to delegate to other >> coroutines. In an asynchronous generator, "yiel

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-08 Thread Ian Kelly
On Wed, Nov 8, 2017 at 11:12 AM, Chris Angelico wrote: > On Thu, Nov 9, 2017 at 5:05 AM, Ian Kelly wrote: >> On Wed, Nov 8, 2017 at 9:31 AM, Chris Angelico wrote: >>> On Thu, Nov 9, 2017 at 3:19 AM, Ian Kelly wrote: I was not referring to the possible future use of yield from for async >>>

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-08 Thread Chris Angelico
On Thu, Nov 9, 2017 at 5:05 AM, Ian Kelly wrote: > On Wed, Nov 8, 2017 at 9:31 AM, Chris Angelico wrote: >> On Thu, Nov 9, 2017 at 3:19 AM, Ian Kelly wrote: >>> I was not referring to the possible future use of yield from for async >>> generators; I was referring to the possibility *today* of us

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-08 Thread Ian Kelly
On Wed, Nov 8, 2017 at 9:31 AM, Chris Angelico wrote: > On Thu, Nov 9, 2017 at 3:19 AM, Ian Kelly wrote: >> I was not referring to the possible future use of yield from for async >> generators; I was referring to the possibility *today* of using "yield >> from" as a synonym for *await*. As far as

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-08 Thread Chris Angelico
On Thu, Nov 9, 2017 at 3:19 AM, Ian Kelly wrote: > I was not referring to the possible future use of yield from for async > generators; I was referring to the possibility *today* of using "yield > from" as a synonym for *await*. As far as I know the only major > obstacle to that is that the author

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-08 Thread Ian Kelly
On Tue, Nov 7, 2017 at 2:42 PM, Chris Angelico wrote: > On Wed, Nov 8, 2017 at 8:16 AM, Ian Kelly wrote: >>> Not one of these is syntactically invalid. Why should "else without >>> break" be trapped by the parser? Your other examples mostly have good >>> parser-level reasons for being errors >> >

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-07 Thread Ian Kelly
On Tue, Nov 7, 2017 at 4:28 PM, Steve D'Aprano wrote: > On Wed, 8 Nov 2017 04:28 am, Ian Kelly wrote: > >> Steve's manufactured interactive example ("manufactured" because >> who really uses for-else interactively? If I really care that much >> about output formatting I'm going to put it in a scr

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-07 Thread Steve D'Aprano
On Wed, 8 Nov 2017 04:28 am, Ian Kelly wrote: > Steve's manufactured interactive example ("manufactured" because > who really uses for-else interactively? If I really care that much > about output formatting I'm going to put it in a script). Me. As I have said. I really don't appreciate you imp

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-07 Thread Chris Angelico
On Wed, Nov 8, 2017 at 8:16 AM, Ian Kelly wrote: > All of these are things that a linter should probably catch and warn > about. If you had said that the break syntax suggestion was a good > idea but probably better suited as a linter warning than as a > SyntaxError integrated into the parser, the

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-07 Thread Ian Kelly
On Tue, Nov 7, 2017 at 12:10 PM, Chris Angelico wrote: > On Wed, Nov 8, 2017 at 4:28 AM, Ian Kelly wrote: >> On Sat, Nov 4, 2017 at 6:40 AM, Chris Angelico wrote: >>> Maybe we're not defending the abuse of other contributors. Maybe we're >>> defending a legitimate, if somewhat caustic, response

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-07 Thread Chris Angelico
On Wed, Nov 8, 2017 at 4:28 AM, Ian Kelly wrote: > On Sat, Nov 4, 2017 at 6:40 AM, Chris Angelico wrote: >> On Sat, Nov 4, 2017 at 11:25 PM, Jon Ribbens >> wrote: >>> On 2017-11-04, Ben Finney wrote: To respond to the criticism of an idea – criticism containing no mention of the pers

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-07 Thread Ian Kelly
On Sat, Nov 4, 2017 at 6:40 AM, Chris Angelico wrote: > On Sat, Nov 4, 2017 at 11:25 PM, Jon Ribbens > wrote: >> On 2017-11-04, Ben Finney wrote: >>> To respond to the criticism of an idea – criticism containing no mention >>> of the person – as though it “clearly refers to the [person]”, is of

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-07 Thread Ian Kelly
On Fri, Nov 3, 2017 at 11:55 PM, Ben Finney wrote: > Ian Kelly writes: > >> Please stop defending the use of incivility on this list. > > Please stop conflating people, who deserve civility, with ideas. We must > not allow the civility deserved by people, to prevent us from > criticising any idea

Re: replacing `else` with `then` in `for` and `try`

2017-11-06 Thread Random832
I haven't read over every message in the thread, so sorry if this has been suggested before, but how about "if not break:" and "if not except:" as synonyms for the current 'else' clause? They're already keywords, and this sequence of keywords has no current meaning. -- https://mail.python.org/mail

Re: replacing 'else' with 'then' in 'for' and 'try'

2017-11-06 Thread ROGER GRAYDON CHRISTMAN
Just a little two-cent opinion from the peanut gallery: I've been following all the discussion on this go by, sometimes getting a bit heated at times, and just sitting nice and safe and secure in my little ivory tower, where I simply tell my students to not use 'break'. As a stodgy educator,

Re: replacing `else` with `then` in `for` and `try`

2017-11-06 Thread Ned Batchelder
On 11/6/17 8:05 AM, Jon Ribbens wrote: On 2017-11-06, Chris Angelico wrote: If you start with the assumption that "intuitively obvious" doesn't actually mean "intuitively obvious" but actually means something completely different, then your statement definitely means something non-contradictory

Re: replacing `else` with `then` in `for` and `try`

2017-11-06 Thread Chris Angelico
On Tue, Nov 7, 2017 at 12:05 AM, Jon Ribbens wrote: > On 2017-11-06, Chris Angelico wrote: >> If you start with the assumption that "intuitively obvious" doesn't >> actually mean "intuitively obvious" but actually means something >> completely different, then your statement definitely means somet

Re: replacing `else` with `then` in `for` and `try`

2017-11-06 Thread Jon Ribbens
On 2017-11-06, Chris Angelico wrote: > If you start with the assumption that "intuitively obvious" doesn't > actually mean "intuitively obvious" but actually means something > completely different, then your statement definitely means something > non-contradictory. But if you start with the assump

Re: replacing `else` with `then` in `for` and `try`

2017-11-06 Thread Chris Angelico
On Mon, Nov 6, 2017 at 10:34 PM, Jon Ribbens wrote: > On 2017-11-06, Ben Finney wrote: >> Jon Ribbens writes: >>> On 2017-11-05, Ben Finney wrote: >>> > Jon Ribbens writes: >>> >> I've provided you with a way of thinking about 'for...else' that makes >>> >> its purpose and meaning intuitively

Re: replacing `else` with `then` in `for` and `try`

2017-11-06 Thread bartc
On 06/11/2017 02:28, Steve D'Aprano wrote: On Sat, 4 Nov 2017 03:57 pm, Michael Torrie wrote: Can you be more specific? What are some of these "many" ways of aborting a loop? Help a guy out here. Aside from more exotic methods such as os.abort, os._exit and signal handlers, the common ways

Re: replacing `else` with `then` in `for` and `try`

2017-11-06 Thread Jon Ribbens
On 2017-11-06, Ben Finney wrote: > Jon Ribbens writes: >> On 2017-11-05, Ben Finney wrote: >> > Jon Ribbens writes: >> >> I've provided you with a way of thinking about 'for...else' that makes >> >> its purpose and meaning intuitively obvious. >> > >> > I've read that sentence several times, an

Re: replacing `else` with `then` in `for` and `try`

2017-11-05 Thread Steve D'Aprano
On Sat, 4 Nov 2017 03:57 pm, Michael Torrie wrote: > On 11/03/2017 09:06 PM, Chris Angelico wrote: >> On Sat, Nov 4, 2017 at 1:57 PM, Michael Torrie wrote: >>> On 11/03/2017 07:09 PM, Steve D'Aprano wrote: On Sat, 4 Nov 2017 06:15 am, Michael Torrie wrote: > In fact if you have no b

Re: replacing `else` with `then` in `for` and `try`

2017-11-05 Thread Steve D'Aprano
On Mon, 6 Nov 2017 01:39 am, Jon Ribbens wrote: > On 2017-11-05, Steve D'Aprano wrote: >> On Sat, 4 Nov 2017 04:44 am, Jon Ribbens wrote: >>> That conforms to my model. It's searching for the condition >>> 'count > MAX_OBJECTS'. >> >> That's sounds to me that you are willing to call just about an

Re: replacing `else` with `then` in `for` and `try`

2017-11-05 Thread Chris Angelico
On Mon, Nov 6, 2017 at 11:06 AM, Steve D'Aprano wrote: > On Mon, 6 Nov 2017 10:06 am, Jon Ribbens wrote: > >> On 2017-11-05, Ben Finney wrote: >>> Jon Ribbens writes: I've provided you with a way of thinking about 'for...else' that makes its purpose and meaning intuitively obvious. >>>

Re: replacing `else` with `then` in `for` and `try`

2017-11-05 Thread Steve D'Aprano
On Mon, 6 Nov 2017 10:06 am, Jon Ribbens wrote: > On 2017-11-05, Ben Finney wrote: >> Jon Ribbens writes: >>> I've provided you with a way of thinking about 'for...else' that makes >>> its purpose and meaning intuitively obvious. >> >> I've read that sentence several times, and I still can't mak

Re: replacing `else` with `then` in `for` and `try`

2017-11-05 Thread Ben Finney
Jon Ribbens writes: > On 2017-11-05, Ben Finney wrote: > > Jon Ribbens writes: > >> I've provided you with a way of thinking about 'for...else' that makes > >> its purpose and meaning intuitively obvious. > > > > I've read that sentence several times, and I still can't make it > > anything but

Re: replacing `else` with `then` in `for` and `try`

2017-11-05 Thread Jon Ribbens
On 2017-11-05, Ben Finney wrote: > Jon Ribbens writes: >> I've provided you with a way of thinking about 'for...else' that makes >> its purpose and meaning intuitively obvious. > > I've read that sentence several times, and I still can't make it > anything but a contradiction in terms. Well, kee

Re: replacing `else` with `then` in `for` and `try`

2017-11-05 Thread Ben Finney
Jon Ribbens writes: > I've provided you with a way of thinking about 'for...else' that makes > its purpose and meaning intuitively obvious. I've read that sentence several times, and I still can't make it anything but a contradiction in terms. Something that is “intuitively obvious” surely has

Re: replacing `else` with `then` in `for` and `try`

2017-11-05 Thread Jon Ribbens
On 2017-11-05, Steve D'Aprano wrote: > On Sat, 4 Nov 2017 04:44 am, Jon Ribbens wrote: >> That conforms to my model. It's searching for the condition >> 'count > MAX_OBJECTS'. > > That's sounds to me that you are willing to call just about any test of a > condition inside a loop a "search". I don'

Re: replacing `else` with `then` in `for` and `try`

2017-11-04 Thread Steve D'Aprano
On Sat, 4 Nov 2017 04:44 am, Jon Ribbens wrote: > On 2017-11-03, Steve D'Aprano wrote: >> The for loop does not necessarily perform a search: >> >> count = 1 >> for obj in sequence: >> if count > MAX_OBJECTS: >> print("too many objects, halting") >> break >> process(obj) >

Re: replacing `else` with `then` in `for` and `try`

2017-11-04 Thread Chris Angelico
On Sat, Nov 4, 2017 at 11:22 PM, Jon Ribbens wrote: > On 2017-11-04, Michael Torrie wrote: >> On 11/03/2017 09:06 PM, Chris Angelico wrote: >>> On Sat, Nov 4, 2017 at 1:57 PM, Michael Torrie wrote: On 11/03/2017 07:09 PM, Steve D'Aprano wrote: > That's incorrect. There are multiple ways

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-04 Thread Chris Angelico
On Sat, Nov 4, 2017 at 11:25 PM, Jon Ribbens wrote: > On 2017-11-04, Ben Finney wrote: >> To respond to the criticism of an idea – criticism containing no mention >> of the person – as though it “clearly refers to the [person]”, is of >> significant concern on a software dicussion forum such as t

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-04 Thread Jon Ribbens
On 2017-11-04, Ben Finney wrote: > To respond to the criticism of an idea – criticism containing no mention > of the person – as though it “clearly refers to the [person]”, is of > significant concern on a software dicussion forum such as this. No, the thing that is "of significant conern on a so

Re: replacing `else` with `then` in `for` and `try`

2017-11-04 Thread Jon Ribbens
On 2017-11-04, Michael Torrie wrote: > On 11/03/2017 09:06 PM, Chris Angelico wrote: >> On Sat, Nov 4, 2017 at 1:57 PM, Michael Torrie wrote: >>> On 11/03/2017 07:09 PM, Steve D'Aprano wrote: That's incorrect. There are multiple ways to exit a loop that will prevent the `else` block fro

Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-03 Thread Ben Finney
Ian Kelly writes: > Steve was clearly referring to the coder, not the code. Not at all. Steve was referring specifically to the *idea*: [A ‘for … else’ structure without a ‘break’] should absolutely not be a syntax error. There's no reason for it to be a syntax error, except to sati

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Michael Torrie
On 11/03/2017 09:06 PM, Chris Angelico wrote: > On Sat, Nov 4, 2017 at 1:57 PM, Michael Torrie wrote: >> On 11/03/2017 07:09 PM, Steve D'Aprano wrote: >>> On Sat, 4 Nov 2017 06:15 am, Michael Torrie wrote: >>> In fact if you have no break you may as well drop the else entirely, because t

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Chris Angelico
On Sat, Nov 4, 2017 at 1:57 PM, Michael Torrie wrote: > On 11/03/2017 07:09 PM, Steve D'Aprano wrote: >> On Sat, 4 Nov 2017 06:15 am, Michael Torrie wrote: >> >>> In fact if you have no break you may as well drop the >>> else entirely, because the block will always execute. >> >> That's incorrect.

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Michael Torrie
On 11/03/2017 07:09 PM, Steve D'Aprano wrote: > On Sat, 4 Nov 2017 06:15 am, Michael Torrie wrote: > >> In fact if you have no break you may as well drop the >> else entirely, because the block will always execute. > > That's incorrect. There are multiple ways to exit a loop that will prevent the

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Steve D'Aprano
On Sat, 4 Nov 2017 06:15 am, Michael Torrie wrote: > In fact if you have no break you may as well drop the > else entirely, because the block will always execute. That's incorrect. There are multiple ways to exit a loop that will prevent the `else` block from executing, `break` is only one. --

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Ian Kelly
On Fri, Nov 3, 2017 at 3:25 PM, Stefan Ram wrote: > Jon Ribbens writes: >>No, it's an obvious bug. You have a 'for...else' with no 'break'. >>Like I said, that should probably be a syntax error. > > It should make the syntax of Python much more complicated, > when one would try to encode this

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Michael Torrie
On 11/03/2017 11:44 AM, Jon Ribbens wrote: > And that's leading you into confusion, as you've demonstrated. And indeed I've been led into considerable confusion about the else: clause over the years. Every time I need to use it, I run a python shell and try it out to remind myself how it works. H

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Ian Kelly
On Fri, Nov 3, 2017 at 8:32 AM, Chris Angelico wrote: > On Fri, Nov 3, 2017 at 10:49 PM, Jon Ribbens > wrote: >> On 2017-11-03, Steve D'Aprano wrote: >>> On Fri, 3 Nov 2017 03:31 am, Jon Ribbens wrote: No, it's an obvious bug. You have a 'for...else' with no 'break'. Like I said, that

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Jon Ribbens
On 2017-11-03, Steve D'Aprano wrote: > The for loop does not necessarily perform a search: > > count = 1 > for obj in sequence: > if count > MAX_OBJECTS: > print("too many objects, halting") > break > process(obj) > else: > print("finished") > > According to your mental

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Jon Ribbens
On 2017-11-03, Chris Angelico wrote: > On Fri, Nov 3, 2017 at 10:49 PM, Jon Ribbens > wrote: >>> It should absolutely not be a syntax error. There's no reason for it >>> to be a syntax error, except to satisfy some arrogant and foolish >>> idea of purity. >> >> It'd be nice if you could be a lit

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Steve D'Aprano
On Fri, 3 Nov 2017 10:49 pm, Jon Ribbens wrote: > On 2017-11-03, Steve D'Aprano wrote: >> On Fri, 3 Nov 2017 03:31 am, Jon Ribbens wrote: >>> No, it's an obvious bug. You have a 'for...else' with no 'break'. >>> Like I said, that should probably be a syntax error. >> >> It should absolutely not b

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Chris Angelico
On Sat, Nov 4, 2017 at 3:15 AM, Alexey Muranov wrote: > On Fri, 2017-11-03 at 22:03 +1100, Chris Angelico wrote: >> On Fri, Nov 3, 2017 at 8:48 PM, Alexey Muranov > com> wrote: >> > 'Then' describes what happens next indeed, unless some >> > extraordinary >> > situation prevents it from happening,

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Alexey Muranov
On Fri, 2017-11-03 at 22:03 +1100, Chris Angelico wrote: > On Fri, Nov 3, 2017 at 8:48 PM, Alexey Muranov com> wrote: > > 'Then' describes what happens next indeed, unless some > > extraordinary > > situation prevents it from happening, for example: > > > > try: > > go_to_the_bakery()

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Chris Angelico
On Fri, Nov 3, 2017 at 10:49 PM, Jon Ribbens wrote: > On 2017-11-03, Steve D'Aprano wrote: >> On Fri, 3 Nov 2017 03:31 am, Jon Ribbens wrote: >>> No, it's an obvious bug. You have a 'for...else' with no 'break'. >>> Like I said, that should probably be a syntax error. >> >> It should absolutely n

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread bartc
On 03/11/2017 11:49, Jon Ribbens wrote: On 2017-11-03, Steve D'Aprano wrote: Right, which is what happens with the for...else block. No. Ok, so look. It's obvious that you and I have different mental models of the situation here. You're thinking of 'for...else' as two arbitrary clauses that

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Jon Ribbens
On 2017-11-03, Steve D'Aprano wrote: > On Fri, 3 Nov 2017 03:31 am, Jon Ribbens wrote: >> No, it's an obvious bug. You have a 'for...else' with no 'break'. >> Like I said, that should probably be a syntax error. > > It should absolutely not be a syntax error. There's no reason for it > to be a syn

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Jon Ribbens
On 2017-11-03, Alexey Muranov wrote: > 'Then' describes what happens next indeed, unless some extraordinary > situation prevents it from happening, for example: > > try: > go_to_the_bakery() > then: > buy_croissants(2) > except BakeryClosed: > go_to_the_grocier

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Chris Angelico
On Fri, Nov 3, 2017 at 8:48 PM, Alexey Muranov wrote: > 'Then' describes what happens next indeed, unless some extraordinary > situation prevents it from happening, for example: > >try: >go_to_the_bakery() >then: >buy_croissants(2) >except BakeryClosed: >go_to_t

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Alexey Muranov
On Thu, 2017-11-02 at 16:31 +, Jon Ribbens wrote: > On 2017-11-02, Steve D'Aprano wrote: > > On Fri, 3 Nov 2017 12:39 am, Jon Ribbens wrote: > > > Why would we want to make the language worse? It is fairly > > > obvious > > > what 'else' means, > > > > Yes, obvious and WRONG. > > Nope, o

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Steve D'Aprano
On Fri, 3 Nov 2017 03:31 am, Jon Ribbens wrote: > On 2017-11-02, Steve D'Aprano wrote: >> On Fri, 3 Nov 2017 12:39 am, Jon Ribbens wrote: >>> Why would we want to make the language worse? It is fairly obvious >>> what 'else' means, >> >> Yes, obvious and WRONG. > > Nope, obvious and right. > >>

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Wolfgang Maier
On 11/02/2017 06:09 PM, Skip Montanaro wrote: Eh, what can I say? I guess I was paying too much attention to the baseball game. Yes, "else" handles the "fall off the end" termination, not the "exit early" termination. My apologies. I do think that having a way to spell "do this when the loop exit

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Skip Montanaro
Eh, what can I say? I guess I was paying too much attention to the baseball game. Yes, "else" handles the "fall off the end" termination, not the "exit early" termination. My apologies. I do think that having a way to spell "do this when the loop exits early" makes things clearer. So, perhaps while

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Jon Ribbens
On 2017-11-02, Steve D'Aprano wrote: > On Fri, 3 Nov 2017 12:39 am, Jon Ribbens wrote: >> Why would we want to make the language worse? It is fairly obvious >> what 'else' means, > > Yes, obvious and WRONG. Nope, obvious and right. > for x in seq: > do_something() > else: > print("seq w

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Steve D'Aprano
On Fri, 3 Nov 2017 12:39 am, Jon Ribbens wrote: > On 2017-11-01, Alexey Muranov wrote: >> what do you think about the idea of replacing "`else`" with "`then`" in >> the contexts of `for` and `try`? >> >> It seems clear that it should be rather "then" than "else." Compare >> also "try ... then ..

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread breamoreboy
On Wednesday, November 1, 2017 at 9:14:05 PM UTC, Alexey Muranov wrote: > Hello, > > what do you think about the idea of replacing "`else`" with "`then`" in > the contexts of `for` and `try`? > > It seems clear that it should be rather "then" than "else." Compare > also "try ... then ... final

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Jon Ribbens
On 2017-11-01, Alexey Muranov wrote: > what do you think about the idea of replacing "`else`" with "`then`" in > the contexts of `for` and `try`? > > It seems clear that it should be rather "then" than "else." Compare > also "try ... then ... finally" with "try ... else ... finally". > > Curren

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Jerry Hill
On Wed, Nov 1, 2017 at 5:12 PM, Alexey Muranov wrote: > what do you think about the idea of replacing "`else`" with "`then`" in > the contexts of `for` and `try`? > ​I wish the core python developers​ had done it 20 years ago. Given that python is a relatively mature language at this point, I d

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Ben Bacarisse
Steve D'Aprano writes: > On Thu, 2 Nov 2017 10:09 pm, Ben Bacarisse wrote: > >> Sure, but your argument seemed to that else has entirely the wrong >> meaning (I certainly to a double take when I have to remember what it >> means) and, in that context, finally has a meaning closer to what you >> w

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Steve D'Aprano
On Thu, 2 Nov 2017 10:09 pm, Ben Bacarisse wrote: > Sure, but your argument seemed to that else has entirely the wrong > meaning (I certainly to a double take when I have to remember what it > means) and, in that context, finally has a meaning closer to what you > want. That's an argument about w

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Ben Bacarisse
Steve D'Aprano writes: > On Thu, 2 Nov 2017 12:50 pm, Ben Bacarisse wrote: > >> Steve D'Aprano writes: >> >>> On Thu, 2 Nov 2017 08:12 am, Alexey Muranov wrote: >>> what do you think about the idea of replacing "`else`" with "`then`" in the contexts of `for` and `try`? > [...] >> Re-u

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Steve D'Aprano
On Thu, 2 Nov 2017 09:04 pm, Steve D'Aprano wrote: > then (with special case) of `pass` That should read "then except for the special case of `pass`". Sorry. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.o

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Steve D'Aprano
On Thu, 2 Nov 2017 12:49 pm, Skip Montanaro wrote: > I don't know. The word "then" doesn't connote different ways of exiting a > loop to me ("else" doesn't really either, I will grant you that, but it's > what we have). Here's how I would read things: > >- *while* some condition holds, execut

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Chris Angelico
On Thu, Nov 2, 2017 at 7:05 PM, Alexey Muranov wrote: > On Wed, 2017-11-01 at 21:30 +, Stefan Ram wrote: >> >> > >> > In languages like Algol 68, »then« is used for a clause >> > that is to be executed when the main condition of an >> > if-statement /is/ true, so this might cause some co

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Alexey Muranov
On Thu, 2017-11-02 at 08:21 +1100, Chris Angelico wrote: > > With try/except/else, it's "do this, and if an exception happens, do this, else do this". So else makes perfect sense. Indeed, i forgot about `except`. I agree that "try/then/except/finally" would be better than "try/except/then/f

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Terry Reedy
On 11/1/2017 5:12 PM, Alexey Muranov wrote: what do you think about the idea of replacing "`else`" with "`then`" in the contexts of `for` and `try`? This idea has been argued to death more than once before. I am opposed on both logical and practical grounds, but will not repeat myself for t

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Alexey Muranov
On Wed, 2017-11-01 at 21:30 +, Stefan Ram wrote: > > In languages like Algol 68, »then« is used for a clause > that is to be executed when the main condition of an > if-statement /is/ true, so this might cause some confusion. > sure, and `else` is used for a clause that is to be execu

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Alexey Muranov
On Thu, 2017-11-02 at 08:29 +1100, Chris Angelico wrote: > On Thu, Nov 2, 2017 at 8:23 AM, Ned Batchelder > > wrote: > > > > > > Apart from the questions of backward compatibility etc (Python is > > unlikely > > to ever go through another shift like the 2/3 breakage), are you > > sure "then" >

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Chris Angelico
On Thu, Nov 2, 2017 at 12:42 PM, bartc wrote: > But if people prefer a different keyword, then why not? I think 'then' can > be used, without impacting its use as an identifier, because it will always > be followed by ":". Of course you would need to allow both "else" and "then" > for backwards co

Re: replacing `else` with `then` in `for` and `try`

2017-11-01 Thread Steve D'Aprano
On Thu, 2 Nov 2017 12:50 pm, Ben Bacarisse wrote: > Steve D'Aprano writes: > >> On Thu, 2 Nov 2017 08:12 am, Alexey Muranov wrote: >> >>> what do you think about the idea of replacing "`else`" with "`then`" in >>> the contexts of `for` and `try`? [...] > Re-using finally would not need a new key

Re: replacing `else` with `then` in `for` and `try`

2017-11-01 Thread Chris Angelico
On Thu, Nov 2, 2017 at 12:19 PM, Steve D'Aprano wrote: > On Thu, 2 Nov 2017 08:21 am, Chris Angelico wrote: > >> With the 'for' loop, >> it's a bit more arguable, but I've never seen anything more than a >> weak argument in favour of 'then' > > Thhpptpt! > > "else" is an completely inappropriate t

Re: replacing `else` with `then` in `for` and `try`

2017-11-01 Thread Ben Bacarisse
Steve D'Aprano writes: > On Thu, 2 Nov 2017 08:12 am, Alexey Muranov wrote: > >> what do you think about the idea of replacing "`else`" with "`then`" in >> the contexts of `for` and `try`? > > Yes, this, exactly!!! > > (For while and for loops, but not try -- see below.) > > I have argued this fo

Re: replacing `else` with `then` in `for` and `try`

2017-11-01 Thread Skip Montanaro
I don't know. The word "then" doesn't connote different ways of exiting a loop to me ("else" doesn't really either, I will grant you that, but it's what we have). Here's how I would read things: - *while* some condition holds, execute the loop, possibly breaking out, *then* do some finishing

Re: replacing `else` with `then` in `for` and `try`

2017-11-01 Thread bartc
On 02/11/2017 01:06, Steve D'Aprano wrote: On Thu, 2 Nov 2017 08:12 am, Alexey Muranov wrote: Hello, what do you think about the idea of replacing "`else`" with "`then`" in the contexts of `for` and `try`? Yes, this, exactly!!! (For while and for loops, but not try -- see below.) I have a

Re: replacing `else` with `then` in `for` and `try`

2017-11-01 Thread bartc
On 02/11/2017 01:19, Steve D'Aprano wrote: On Thu, 2 Nov 2017 08:21 am, Chris Angelico wrote: With the 'for' loop, it's a bit more arguable, but I've never seen anything more than a weak argument in favour of 'then' Thhpptpt! "else" is an completely inappropriate term that doesn't describe t

Re: replacing `else` with `then` in `for` and `try`

2017-11-01 Thread Steve D'Aprano
On Thu, 2 Nov 2017 08:23 am, Ned Batchelder wrote: > Apart from the questions of backward compatibility etc (Python is > unlikely to ever go through another shift like the 2/3 breakage), are > you sure "then" is what you mean?  This won't print "end": > > for i in range(10): > print(i) > e

Re: replacing `else` with `then` in `for` and `try`

2017-11-01 Thread Steve D'Aprano
On Thu, 2 Nov 2017 08:21 am, Chris Angelico wrote: > With the 'for' loop, > it's a bit more arguable, but I've never seen anything more than a > weak argument in favour of 'then' Thhpptpt! "else" is an completely inappropriate term that doesn't describe the semantics of the statement even a litt

Re: replacing `else` with `then` in `for` and `try`

2017-11-01 Thread Steve D'Aprano
On Thu, 2 Nov 2017 08:12 am, Alexey Muranov wrote: > Hello, > > what do you think about the idea of replacing "`else`" with "`then`" in > the contexts of `for` and `try`? Yes, this, exactly!!! (For while and for loops, but not try -- see below.) I have argued this for many years. The current

Re: replacing `else` with `then` in `for` and `try`

2017-11-01 Thread Ned Batchelder
On 11/1/17 5:29 PM, Chris Angelico wrote: On Thu, Nov 2, 2017 at 8:23 AM, Ned Batchelder wrote: On 11/1/17 5:12 PM, Alexey Muranov wrote: Hello, what do you think about the idea of replacing "`else`" with "`then`" in the contexts of `for` and `try`? It seems clear that it should be rather "t

Re: replacing `else` with `then` in `for` and `try`

2017-11-01 Thread Chris Angelico
On Thu, Nov 2, 2017 at 8:23 AM, Ned Batchelder wrote: > On 11/1/17 5:12 PM, Alexey Muranov wrote: >> >> Hello, >> >> what do you think about the idea of replacing "`else`" with "`then`" in >> the contexts of `for` and `try`? >> >> It seems clear that it should be rather "then" than "else." Compare

Re: replacing `else` with `then` in `for` and `try`

2017-11-01 Thread Ned Batchelder
On 11/1/17 5:12 PM, Alexey Muranov wrote: Hello, what do you think about the idea of replacing "`else`" with "`then`" in the contexts of `for` and `try`? It seems clear that it should be rather "then" than "else." Compare also "try ... then ... finally" with "try ... else ... finally". Cur

Re: replacing `else` with `then` in `for` and `try`

2017-11-01 Thread Chris Angelico
On Thu, Nov 2, 2017 at 8:12 AM, Alexey Muranov wrote: > Hello, > > what do you think about the idea of replacing "`else`" with "`then`" in the > contexts of `for` and `try`? > > It seems clear that it should be rather "then" than "else." Compare also > "try ... then ... finally" with "try ... els

replacing `else` with `then` in `for` and `try`

2017-11-01 Thread Alexey Muranov
Hello, what do you think about the idea of replacing "`else`" with "`then`" in the contexts of `for` and `try`? It seems clear that it should be rather "then" than "else." Compare also "try ... then ... finally" with "try ... else ... finally". Currently, with "else", it is almost impossib