On 2022-03-07 06:00:57 -0800, Grant Edwards wrote:
> On 2022-03-07, Peter J. Holzer wrote:
> > On 2022-03-06 18:34:39 -0800, Grant Edwards wrote:
> >> On 2022-03-06, Avi Gross via Python-list wrote:
> >> > Python is named after a snake right?
> >>
> >> No. It's named after a comedy troupe.
> >
>
Op 4/03/2022 om 02:08 schreef Avi Gross via Python-list:
If Python was being designed TODAY, I wonder if a larger set of key words would
be marked as RESERVED for future expansion including ORELSE and even
NEVERTHELESS.
I think a better solution would be to have reserved words written lette
On Mon, 7 Mar 2022 18:07:42 +, "Schachner, Joseph"
declaimed the following:
>Can someone please change the topic of this thread? No longer about for-else.
>
Pretty much anyone can change the subject of the message when replying.
But if one is using a threa
Can someone please change the topic of this thread? No longer about for-else.
Teledyne Confidential; Commercially Sensitive Business Data
-Original Message-
From: Dennis Lee Bieber
Sent: Sunday, March 6, 2022 1:29 PM
To: python-list@python.org
Subject: Re: Behavior of the for-else
On 2022-03-07, Peter J. Holzer wrote:
> On 2022-03-06 18:34:39 -0800, Grant Edwards wrote:
>> On 2022-03-06, Avi Gross via Python-list wrote:
>> > Python is named after a snake right?
>>
>> No. It's named after a comedy troupe.
>
> He actually wrote that two sentences later.
Yes, I missed that.
On 2022-03-06 18:34:39 -0800, Grant Edwards wrote:
> On 2022-03-06, Avi Gross via Python-list wrote:
> > Python is named after a snake right?
>
> No. It's named after a comedy troupe.
He actually wrote that two sentences later.
hp
--
_ | Peter J. Holzer| Story must make more s
On 2022-03-06, Avi Gross via Python-list wrote:
> Python is named after a snake right?
No. It's named after a comedy troupe.
--
Grant
--
https://mail.python.org/mailman/listinfo/python-list
On Sun, 6 Mar 2022 17:39:51 +0100, "Peter J. Holzer"
declaimed the following:
>
>(* *) for comments was actually pretty commonly used - maybe because it
>stands out more than { }. I don't know if I've ever seen (. .) instead
>of [ ].
>
Or some terminals provided [ ] but not { }
On Mon, 7 Mar 2022 at 09:51, Avi Gross via Python-list
wrote:
>
> >>>
> Pascal versus PASCAL versus pascal (not versus paschal) and
> Perl versus PERL versus perl (not versus pearl)
>
> seems to be a topic.
> <<<
>
> The nitpickers here are irrelevant. I happen to know how things are formally
> s
orrect, it has a
proper spelling. But following that reasoning, why does anyone give an email
address of john.sm...@gmail.com or jane...@yahoo.com instead of ...?
-Original Message-
From: Peter J. Holzer
To: python-list@python.org
Sent: Sun, Mar 6, 2022 12:48 pm
Subject: Re: Behavior
On 2022-03-06 09:29:19 -0800, Grant Edwards wrote:
> On 2022-03-05, Avi Gross via Python-list wrote:
> > I am not sure how we end up conversing about PASCAL on a Python
> > forum.
> > [...]
> > I paid no attention to where PASCAL was being used other than I did
> > much of my grad school work in P
On 2022-03-05, Avi Gross via Python-list wrote:
> I am not sure how we end up conversing about PASCAL on a Python
> forum.
> [...]
> I paid no attention to where PASCAL was being used other than I did
> much of my grad school work in PASCAL [...]
It's "Pascal". It's not an acronym. It's a guy's
On 2022-03-05 14:25:35 -0500, Dennis Lee Bieber wrote:
> On Sat, 5 Mar 2022 12:39:36 -0600, "Michael F. Stemper"
> declaimed the following:
> >... especially Pascal, which was probably bigger in Germany and Austria
> >in the 1980s than was C.
>
> Pascal also defined alternate representation
and other languages
to undergrads ;-)
-Original Message-
From: Dennis Lee Bieber
To: python-list@python.org
Sent: Sat, Mar 5, 2022 7:00 pm
Subject: Re: Behavior of the for-else construct
On Sat, 5 Mar 2022 21:40:08 + (UTC), Avi Gross
declaimed the following:
>I am not sure how we end
On Sat, 5 Mar 2022 21:40:08 + (UTC), Avi Gross
declaimed the following:
>I am not sure how we end up conversing about PASCAL on a Python forum. But it
>is worth considering how people educated in aspects of Computer Science often
>come from somewhat different background and how it flavors w
On 05Mar2022 17:48, Avi Gross wrote:
>Since we still seem to be dreaming, I wonder when someone will suggest using
>some variation of the new match statement.
Ugh :-)
But...
What if break were implemented with an exception, like StopIteration but
for interruption instead of stop? And for-loop
To: python-list@python.org
Sent: Sat, Mar 5, 2022 1:39 pm
Subject: Re: Behavior of the for-else construct
On 04/03/2022 18.11, Peter J. Holzer wrote:
> On 2022-03-04 23:47:09 +, Avi Gross via Python-list wrote:
>> I am not sure a reply is needed, Peter, and what you say is true. But
On 04/03/2022 18.11, Peter J. Holzer wrote:
On 2022-03-04 23:47:09 +, Avi Gross via Python-list wrote:
I am not sure a reply is needed, Peter, and what you say is true. But
as you point out, when using a German keyboard, I would already have
a way to enter symbols like ä, ö, ü and ß and no
On Sat, 5 Mar 2022 12:39:36 -0600, "Michael F. Stemper"
declaimed the following:
>... especially Pascal, which was probably bigger in Germany and Austria
>in the 1980s than was C.
Pascal also defined alternate representations (per Jensen&Wirth) for
some of those (and I don't recall ever
my part of this endless conversation may have gone a bit beyond far
enough and I await some new topics.
-Original Message-
From: Rob Cliffe via Python-list
To: python-list@python.org
Sent: Sat, Mar 5, 2022 7:15 am
Subject: Re: Behavior of the for-else construct
On 05/03/2022 01:15, Camer
On 05/03/2022 01:15, Cameron Simpson wrote:
I sort of wish it had both "used break" and "did not use break"
branches, a bit like try/except/else.
And "zero iterations".
Rob Cliffe
--
https://mail.python.org/mailman/listinfo/python-list
On 2022-03-05 00:25:44 +0100, Peter J. Holzer wrote:
> On 2022-03-04 11:34:07 +1100, Chris Angelico wrote:
> > What I'm hearing is that there are, broadly speaking, two types of
> > programmers [1]:
> >
> > 1) Those who think about "for-else" as a searc
On 03Mar2022 14:24, computermaster360 wrote:
>I want to make a little survey here.
>
>Do you find the for-else construct useful? Have you used it in
>practice? Do you even know how it works, or that there is such a thing
>in Python?
I used Python for years before understanding th
On 2022-03-04 23:47:09 +, Avi Gross via Python-list wrote:
> I am not sure a reply is needed, Peter, and what you say is true. But
> as you point out, when using a German keyboard, I would already have
> a way to enter symbols like ä, ö, ü and ß and no reason not to include
> them in variable
hon-list@python.org
Sent: Fri, Mar 4, 2022 5:57 pm
Subject: Re: Behavior of the for-else construct
On 2022-03-04 00:38:22 +, Avi Gross via Python-list wrote:
> I have seen major struggles to get other character sets into
> languages. Any new language typically should have this built in from
> s
as implying something else. ELSE is ambiguous in the context it
> > > is used.
> >
> > What I'm hearing is that there are, broadly speaking, two types of
> > programmers [1]:
> >
> > 1) Those who think about "for-else" as a search tool and perf
d.
>
> What I'm hearing is that there are, broadly speaking, two types of
> programmers [1]:
>
> 1) Those who think about "for-else" as a search tool and perfectly
> understand how it behaves
> 2) Those who have an incorrect idea about what for-else is supposed to
To: python-list@python.org
Sent: Fri, Mar 4, 2022 5:22 pm
Subject: Re: Behavior of the for-else construct
On 04/03/2022 20:52, Avi Gross via Python-list wrote:
>
> I have an observation about exception handling in general. Some people use
> exceptions, including ones they create and t
On 2022-03-04 14:04:48 -0600, Om Joshi wrote:
> I'm not sure if anyone has mentioned it on this thread, but with
> respect to your comment about adding either on.empty or a decorator,
> the Django template syntax uses
>
> {% for x in iterator %}
> {{ x }}
> {% empty %}
> Empty
> {% endfor %}
>
On 2022-03-04 08:38:52 -0600, Tim Chase wrote:
> On 2022-03-04 11:55, Chris Angelico wrote:
> > In MS-DOS, it was perfectly possible to have spaces in file names
>
> DOS didn't allow space (0x20) in filenames unless you hacked it by
> hex-editing your filesystem (which I may have done a couple tim
On 2022-03-04 00:38:22 +, Avi Gross via Python-list wrote:
> I have seen major struggles to get other character sets into
> languages. Any new language typically should have this built in from
> scratch and should consider adding non-ASCII characters into the mix.
> Mathematicians often use lot
On 04/03/2022 20:52, Avi Gross via Python-list wrote:
I have an observation about exception handling in general. Some people use
exceptions, including ones they create and throw, for a similar idea. You might
for example try to use an exception if your first attempt fails that specifies
try
lows
something like:
result = for ...
That might return 0 or None if it was part of the language but it is not.
Avi (my current first name)
-Original Message-
From: Om Joshi
To: Avi Gross
Cc: python-list
Sent: Fri, Mar 4, 2022 3:04 pm
Subject: Re: Behavior of the for-else constru
On 03/03/2022 19.54, Rob Cliffe wrote:
On 04/03/2022 01:44, Ethan Furman wrote:
On 3/3/22 5:32 PM, Rob Cliffe via Python-list wrote:
> There are three types of programmer: those that can count, and those that
can't.
Actually, there are 10 types of programmer: those that can count in binary,
On Sat, 5 Mar 2022 at 07:52, Avi Gross wrote:
>
> Chris,
>
> My example was precisely what to do when it is an empty closet:
Does it correctly handle a closet with shirts in it, though?
There's not a lot of point demonstrating an alternate use for the
"else" clause when it is *absolutely identic
ye==4 after the
loop. The above loop would leave it as aye==None which keeps it from being
undefined. To decide if the loop ran at all would thus require further code
such as:
if aye == None:
...
Which leads me right back to wondering why the sentinel approach is so bad!
-----Origi
On 2022-03-04 at 11:14:29 -0500,
Dennis Lee Bieber wrote:
> Try to tell the difference between
>
> afileand
> afile
>
> when doing a directory listing.
Easy: log in over a 110 baud modem, where the characters take almost as
much time as the beep. ;-)
--
https://mail.python
English or are more fluent in other languages. T may may be used to other
> word orders for example. They may move verbs to the end of a sentence or
> place adjectives or other modifiers after versus before a word and forget
> about all the other games played where the same word
er versus before a word and forget about all
the other games played where the same word means something completely
different. To them ELSE may either mean nothing or the phrase IF ... ELSE may
be said differently or adding a clause after the construct is not seen as
natural.
So was this way of doing FO
On Fri, 4 Mar 2022 08:38:52 -0600, Tim Chase
declaimed the following:
>DOS didn't allow space (0x20) in filenames unless you hacked it by
>hex-editing your filesystem (which I may have done a couple times).
>However it did allow you to use 0xFF in filenames which *appeared* as
>a space in most ch
On Sat, 5 Mar 2022 at 03:44, Avi Gross via Python-list
wrote:
>
> Dieter,
>
> Your use is creative albeit it is not "needed" since all it does is make sure
> your variable is initialized to something, specifically None.
>
> So would this not do the same thing?
>
> eye = None
>
> for eye in ra
On Sat, 5 Mar 2022 at 02:02, Tim Chase wrote:
>
> On 2022-03-04 11:55, Chris Angelico wrote:
> > In MS-DOS, it was perfectly possible to have spaces in file names
>
> DOS didn't allow space (0x20) in filenames unless you hacked it by
> hex-editing your filesystem (which I may have done a couple t
Avi Gross wrote at 2022-3-4 16:43 +:
>Your use is creative albeit it is not "needed" since all it does is make sure
>your variable is initialized to something, specifically None.
>
>So would this not do the same thing?
>
> eye = None
>
> for eye in range(0):
> print(eye)
>
> eye
It wo
as discussed, you could do an IF statement to check if closet is empty but
for iterators, it gets ...
-Original Message-
From: Dieter Maurer
To: Rob Cliffe
Cc: python-list@python.org
Sent: Fri, Mar 4, 2022 2:12 am
Subject: Re: Behavior of the for-else construct
Rob Cliffe wrote at 2022-3
On 2022-03-04 11:55, Chris Angelico wrote:
> In MS-DOS, it was perfectly possible to have spaces in file names
DOS didn't allow space (0x20) in filenames unless you hacked it by
hex-editing your filesystem (which I may have done a couple times).
However it did allow you to use 0xFF in filenames wh
On Fri, 4 Mar 2022 at 21:02, gene heskett wrote:
> That makes the logic work, but who then cleans up the trash on the stack.
> Thats a memory leak.
>
Not sure I follow?
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
On Friday, 4 March 2022 02:18:51 EST Chris Angelico wrote:
> On Fri, 4 Mar 2022 at 18:13, Dieter Maurer wrote:
> > Rob Cliffe wrote at 2022-3-4 00:13 +:
> > >I find it so hard to remember what `for ... else` means that on the
> > >very few occasions I have used
em")
There's a parallel here. Since a for-else loop is basically useless
without an if-break construct inside it, the else clause can be
thought of as the else on a massive if/elif chain:
if stuff[0].is_good:
print("This item is good", stuff[0])
elif stuff[1].is_good:
Op 4/03/2022 om 8:18 schreef Chris Angelico:
On Fri, 4 Mar 2022 at 18:13, Dieter Maurer wrote:
> One of my use cases for `for - else` does not involve a `break`:
> the initialization of the loop variable when the sequence is empty.
> It is demonstrated by the following transscript:
>
On Fri, 4 Mar 2022 at 18:13, Dieter Maurer wrote:
>
> Rob Cliffe wrote at 2022-3-4 00:13 +:
> >I find it so hard to remember what `for ... else` means that on the very
> >few occasions I have used it, I ALWAYS put a comment alongside/below the
> >`else` to remind
Rob Cliffe wrote at 2022-3-4 00:13 +:
>I find it so hard to remember what `for ... else` means that on the very
>few occasions I have used it, I ALWAYS put a comment alongside/below the
>`else` to remind myself (and anyone else unfortunate enough to read my
>code) what trig
On Fri, 4 Mar 2022 at 14:37, Avi Gross via Python-list
wrote:
>
> That is one way to look at it, Jach. Of course, a particular loop may have
> multiple break statements each meaning something else. The current
> implementation makes all of them jump to the same ELSE statement so in one
> sense,
an ELSE dangling.
-Original Message-
From: Jach Feng
To: python-list@python.org
Sent: Thu, Mar 3, 2022 9:22 pm
Subject: Re: Behavior of the for-else construct
I never feel confused by "else" because I always think it in "break...else",
not "for...else".
On Fri, 4 Mar 2022 at 14:05, Avi Gross via Python-list
wrote:
> To answer something Chris said and was also mentioned here, I do not consider
> language design to be easy let alone implementing it. Not at all. BUT I think
> some changes can be straightforward. Having a symbol like a curly brace
hen you die and it simplifies.
-Original Message-
From: Rob Cliffe via Python-list
To: python-list@python.org
Sent: Thu, Mar 3, 2022 8:41 pm
Subject: Re: Behavior of the for-else construct
On 04/03/2022 00:38, Avi Gross via Python-list wrote:
> Rob,
>
> I regularly code with l
I never feel confused by "else" because I always think it in "break...else",
not "for...else". For those who always think in "for...else" deserves this
confusion and it can't be just escaped by replacing with another magic word
such as
On 04/03/2022 00:55, Chris Angelico wrote:
for victim in debtors:
if victim.pay(up): continue
if victim.late(): break
or else:
victim.sleep_with(fishes)
If you mean "or else" to be synonymous with "else", then only the last
debtor is killed, whether he has paid up or not, whic
On 04/03/2022 01:44, Ethan Furman wrote:
On 3/3/22 5:32 PM, Rob Cliffe via Python-list wrote:
> There are three types of programmer: those that can count, and those
that can't.
Actually, there are 10 types of programmer: those that can count in
binary, and those that can't.
1, 10, many.
On 4/03/22 1:55 pm, Chris Angelico wrote:
It's much better to treat arguments as a vector of strings
rather than a single string, as the start command tries to.
It would be nice if you could, but as I understand it, Windows always
passes arguments to a program as a single string, and then it's
On 3/3/22 5:32 PM, Rob Cliffe via Python-list wrote:
> There are three types of programmer: those that can count, and those that
can't.
Actually, there are 10 types of programmer: those that can count in binary,
and those that can't.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/pyt
On 04/03/2022 00:43, Chris Angelico wrote:
On Fri, 4 Mar 2022 at 11:14, Rob Cliffe via Python-list
wrote:
I find it so hard to remember what `for ... else` means that on the very
few occasions I have used it, I ALWAYS put a comment alongside/below the
`else` to remind myself (and anyone
ython-list
To: python-list@python.org
Sent: Thu, Mar 3, 2022 7:13 pm
Subject: Re: Behavior of the for-else construct
I find it so hard to remember what `for ... else` means that on the very
few occasions I have used it, I ALWAYS put a comment alongside/below the
`else` to remind myself (and anyo
e are, broadly speaking, two types of
programmers [1]:
1) Those who think about "for-else" as a search tool and perfectly
understand how it behaves
2) Those who have an incorrect idea about what for-else is supposed to
do, don't understand it, and don't like it.
Or those who have a
n
NEVERTHELESS.
-Original Message-
From: Chris Angelico
To: python-list@python.org
Sent: Thu, Mar 3, 2022 7:34 pm
Subject: Re: Behavior of the for-else construct
On Fri, 4 Mar 2022 at 10:09, Avi Gross via Python-list
wrote:
>
> The drumbeat I keep hearing is that some people h
On Fri, 4 Mar 2022 at 11:39, Avi Gross via Python-list
wrote:
>
> Rob,
>
> I regularly code with lots of comments like the one you describe, or mark the
> end of a region that started on an earlier screen such as a deeply nested
> construct.
>
> I have had problems though when I have shared such
On Fri, 4 Mar 2022 at 11:14, Rob Cliffe via Python-list
wrote:
>
> I find it so hard to remember what `for ... else` means that on the very
> few occasions I have used it, I ALWAYS put a comment alongside/below the
> `else` to remind myself (and anyone else unfortunate enough to re
Thu, Mar 3, 2022 7:13 pm
Subject: Re: Behavior of the for-else construct
I find it so hard to remember what `for ... else` means that on the very
few occasions I have used it, I ALWAYS put a comment alongside/below the
`else` to remind myself (and anyone else unfortunate enough to read my
code)
of
programmers [1]:
1) Those who think about "for-else" as a search tool and perfectly
understand how it behaves
2) Those who have an incorrect idea about what for-else is supposed to
do, don't understand it, and don't like it.
You could easily make a similar point about a l
I find it so hard to remember what `for ... else` means that on the very
few occasions I have used it, I ALWAYS put a comment alongside/below the
`else` to remind myself (and anyone else unfortunate enough to read my
code) what triggers it, e.g.
for item in search_list
age must be added to sparingly and with so many requests, perhaps
only a few non bug-fixes can seriously be considered.
-Original Message-
From: Akkana Peck
To: python-list@python.org
Sent: Thu, Mar 3, 2022 5:33 pm
Subject: Re: Behavior of the for-else construct
computermaster360 writes
computermaster360 writes:
> I want to make a little survey here.
>
> Do you find the for-else construct useful?
No.
> Have you used it in practice?
Once or twice, but ended up removing it, see below.
> Do you even know how it works, or that there is such a thing in Python?
I
On 2022-03-03, computermaster360 wrote:
> Do you find the for-else construct useful? Have you used it in
> practice?
Yes, I use it frequently.
> I have used it maybe once. My issue with this construct is that
> calling the second block `else` doesn't make sense; a much mor
On 03/03/2022 07.24, computermaster360 wrote:
I want to make a little survey here.
Do you find the for-else construct useful? Have you used it in
practice? Do you even know how it works, or that there is such a thing
in Python?
I only found out about it within the last year or so. I've
On Thu, 3 Mar 2022 at 18:25, Schachner, Joseph
wrote:
> I don't know what that would be. "finally" is available 😊 Write up a
> feature request.
Not sure if you mean `finally` seriously but I think that would about
as confusing as the current `else`, if not even more 😅
Meanwhile, I found anoth
re request.
--- Joseph S.
Teledyne Confidential; Commercially Sensitive Business Data
-Original Message-
From: computermaster360
Sent: Thursday, March 3, 2022 8:24 AM
To: python-list@python.org
Subject: Behavior of the for-else construct
I want to make a little survey here.
Do you fi
computermaster360 wrote at 2022-3-3 14:24 +0100:
>Do you find the for-else construct useful?
Yes.
>Have you used it in practice?
Yes
--
https://mail.python.org/mailman/listinfo/python-list
if the loop was executed zero times
but these have not been accepted.
Best wishes
Rob Cliffe
On 03/03/2022 13:24, computermaster360 wrote:
I want to make a little survey here.
Do you find the for-else construct useful? Have you used it in
practice? Do you even know how it works, or that there
Op 3/03/2022 om 14:24 schreef computermaster360:
I want to make a little survey here.
Do you find the for-else construct useful? Have you used it in
practice? Do you even know how it works, or that there is such a thing
in Python?
- No, or at least not when balanced against the drawbacks as I
On 2022-03-03, computermaster360 wrote:
> Do you find the for-else construct useful?
Yes.
> Have you used it in practice?
Yes.
I don't use it often, but I do use it occasionally.
However, I always have to look it up the docs to confirm the logic. I
always feel like the els
On 2022-03-04 02:02, Chris Angelico wrote:
>> I want to make a little survey here.
>>
>> Do you find the for-else construct useful? Have you used it in
>> practice? Do you even know how it works, or that there is such a
>> thing in Python?
>
> Yes, yes, and y
> On 3 Mar 2022, at 13:24, computermaster360
> wrote:
>
> I want to make a little survey here.
>
> Do you find the for-else construct useful?
No. I always have to look up what condition the else fires on.
> Have you used it in
> practice?
No.
> Do you even
On Fri, 4 Mar 2022 at 00:25, computermaster360
wrote:
>
> I want to make a little survey here.
>
> Do you find the for-else construct useful? Have you used it in
> practice? Do you even know how it works, or that there is such a thing
> in Python?
Yes, yes, and yes-yes. It&
On Thu, Mar 3, 2022 at 5:24 AM computermaster360 <
computermaster...@gmail.com> wrote:
> I want to make a little survey here.
>
> Do you find the for-else construct useful? Have you used it in
> practice? Do you even know how it works, or that there is such a thing
> in Pytho
I want to make a little survey here.
Do you find the for-else construct useful? Have you used it in
practice? Do you even know how it works, or that there is such a thing
in Python?
I have used it maybe once. My issue with this construct is that
calling the second block `else` doesn't make
On Fri, 3 Nov 2017 09:13 pm, Serhiy Storchaka wrote:
> What the interpreter or configuration do you use? The standard
> interpreter uses '>>> ' as a prompt.
I have this in my Python startup file:
if (sys.version_info[0] >= 3 and os.name == 'posix'
and os.environ['TERM'] in ['xterm', 'vt1
02.11.17 12:10, Steve D'Aprano пише:
Occasionally it is useful to loop over a bunch of stuff in the interactive
interpreter, printing them as you go on a single line:
for x in something():
print(x, end='')
If you do that, the prompt overwrites your output, and you get a mess:
py> for x i
f count == 60:
print(' ', time.asctime())
count = 0
print('.', end='')
expensive_time_consuming_process_that_might_take_minutes_or_hours(obj)
count += 1
else:
del count
print()
print("finished at", time.asctime())
Now honestly, do y
Steve D'Aprano writes:
> for x in something():
> print(x, end='')
print(''.join(something()))
--
https://mail.python.org/mailman/listinfo/python-list
On 11/2/2017 8:53 PM, Steve D'Aprano wrote:
On Fri, 3 Nov 2017 09:20 am, Terry Reedy wrote:
This seems like a bug in how Python interacts with your console. On
Windows, in Python started from an icon or in Command Prompt:
>>> for c in 'abc': print(c, end='')
...
abc>>>
That's still unfortu
On Fri, 3 Nov 2017 09:20 am, Terry Reedy wrote:
> This seems like a bug in how Python interacts with your console. On
> Windows, in Python started from an icon or in Command Prompt:
>
> >>> for c in 'abc': print(c, end='')
> ...
> abc>>>
That's still unfortunate: the prompt is immediately afte
7;')
...
abc>>>
IDLE adds \n if needed, so prompts always starts on a fresh line.
>>> for x in 'abcdefgh':
print(x, end='')
abcdefgh
>>>
"For ... else" to the rescue!
py> for char in "abcdefgh":
... print(char, end='')
... else:
... print()
...
abcdefgh
py>
--
Terry Jan Reedy
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, 2 Nov 2017 10:45 pm, Alberto Berti wrote:
>>>>>> "Steve" == Steve D'Aprano writes:
>
> py> for x in "abcdefgh":
> Steve> ... print(x, end='')
> Steve> ...
> py> efghpy>
>
>
&g
> "Wolfgang" == Wolfgang Maier
> writes:
Wolfgang> Try running it interactively and you'll see,
Wolfgang> wolfgang
I've tried but my muscolar memory failed me... i've issued a C-c C-c
that usually would have sent the region of text to the interpreter
session (when done from python
On 11/02/2017 12:45 PM, Alberto Berti wrote:
"Steve" == Steve D'Aprano writes:
py> for x in "abcdefgh":
Steve> ... print(x, end='')
Steve> ...
py> efghpy>
Steve> "For ... else" to the rescue!
>>>>> "Steve" == Steve D'Aprano writes:
py> for x in "abcdefgh":
Steve> ... print(x, end='')
Steve> ...
py> efghpy>
Steve> "For ... else" to the rescue!
py> for char in "abcdefgh&
;:
... print(x, end='')
...
py> efghpy>
"For ... else" to the rescue!
py> for char in "abcdefgh":
... print(char, end='')
... else:
... print()
...
abcdefgh
py>
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered
On Wed, Jun 29, 2016 at 7:11 AM Victor Savu
wrote:
> Please let me know if you are interested in a more concrete case such as a
> domain-specific application (I can think of progress bars, logging,
> transfer rate statistics ...).
>
Yes, please. I'd like to compare the proposed syntax against th
Sure.
Simple use-case: Decorate the yielded values and the return value of a
generator. Right now, with `yield from` you can only decorate the return
value, whereas with a for loop you can decorate the yielded values, but you
sacrifice the returned value altogether.
```
def ret_decorator(target_g
On Mon, Jun 27, 2016 at 12:53 AM Victor Savu
wrote:
> capture the [StopIteration] value in the `else` statement of the `for` loop
>
I'm having trouble thinking of a case when this new feature is necessary.
Can you show a more realistic example?
--
https://mail.python.org/mailman/listinfo/python
lause of the `for ..
else`
statement:
Generators raise StopIteration on the return statement. The exception
captures the return value. The `for` statement catches the
`StopIteration`
exception to know when to jump to the optional `else` statement, but
discards the enclosed return
101 - 200 of 291 matches
Mail list logo