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.
--
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,
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
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
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
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
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
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'
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
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
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
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
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.
> >
> >
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
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
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
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")
>>
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,
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
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
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.
>>
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
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.
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
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.
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
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")
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
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.
>>
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
>> >
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:
> >
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
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'
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
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:
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
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,
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.
>
>
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
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
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:
>
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."
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 ...
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 ...
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
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
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
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`"
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.
--
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,
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,
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
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
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
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),
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"
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
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
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
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
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
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
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)
>
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
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
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
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
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".
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 ...
69 matches
Mail list logo