Re: Behavior of the for-else construct

2022-03-03 Thread Chris Angelico
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 myself (and anyone else unfort

Re: Behavior of the for-else construct

2022-03-03 Thread Dieter Maurer
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 triggers it, e.g. > >    

Re: Python

2022-03-03 Thread Dan Stromberg
Whatever happened to sending a URL to a specific answer in a FAQ list? On Thu, Mar 3, 2022 at 12:52 PM Dan Ciprus (dciprus) via Python-list < python-list@python.org> wrote: > if OP formulates question the way he/she did, it's not worth to respond to > it. > There is plenty of similar questions in

Re: Behavior of the for-else construct

2022-03-03 Thread Chris Angelico
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,

Re: Behavior of the for-else construct

2022-03-03 Thread Avi Gross via Python-list
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, I consider the ELSE to be associated with the loop as a whole. Sometimes

Re: Behavior of the for-else construct

2022-03-03 Thread Chris Angelico
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

Re: Behavior of the for-else construct

2022-03-03 Thread Avi Gross via Python-list
Rob, I consider my comments in code I write to be a (silent) part of the code, or worse, some code I commented out but want to be able to look at. I often have code like: # NOTE you can turn on one of the following that applies to your situation # and comment out the others but leave them in pl

Re: Behavior of the for-else construct

2022-03-03 Thread Jach Feng
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 "then" or "finally" etc:-) --Jach -- https://mail.python.

Re: Behavior of the for-else construct

2022-03-03 Thread Rob Cliffe via Python-list
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

Re: Behavior of the for-else construct

2022-03-03 Thread Rob Cliffe via Python-list
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.

Re: Behavior of the for-else construct

2022-03-03 Thread Greg Ewing
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

Re: Behavior of the for-else construct

2022-03-03 Thread Ethan Furman
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

Re: Behavior of the for-else construct

2022-03-03 Thread Rob Cliffe via Python-list
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 else

Re: Behavior of the for-else construct

2022-03-03 Thread Rob Cliffe via Python-list
On 04/03/2022 00:38, 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. So do I (and not just in Python).  It's good practice. I have had p

Re: Behavior of the for-else construct

2022-03-03 Thread Rob Cliffe via Python-list
On 04/03/2022 00:34, Chris Angelico wrote: On Fri, 4 Mar 2022 at 10:09, Avi Gross via Python-list wrote: The drumbeat I keep hearing is that some people hear/see the same word as implying something else. ELSE is ambiguous in the context it is used. What I'm hearing is that there are, broad

Re: Behavior of the for-else construct

2022-03-03 Thread Avi Gross via Python-list
Chris, Much of what I intended is similar to what you say. I am simply saying the existing group of programmers seems to include people who will not see every thing the same way. There is no way to make them all happy and you have other constraints like not suddenly adding new reserved words, s

Re: Behavior of the for-else construct

2022-03-03 Thread Chris Angelico
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

Re: Behavior of the for-else construct

2022-03-03 Thread Chris Angelico
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 read my > code) wh

Re: Behavior of the for-else construct

2022-03-03 Thread Avi Gross via Python-list
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 code and the recipient strips my comments and then later wants me to make c

Re: Behavior of the for-else construct

2022-03-03 Thread Chris Angelico
On Fri, 4 Mar 2022 at 10:09, Avi Gross via Python-list wrote: > > The drumbeat I keep hearing is that some people hear/see the same word 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]

Re: Behavior of the for-else construct

2022-03-03 Thread Rob Cliffe via Python-list
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:         ...        

Re: Behavior of the for-else construct

2022-03-03 Thread Avi Gross via Python-list
The drumbeat I keep hearing is that some people hear/see the same word as implying something else. ELSE is ambiguous in the context it is used. And naturally, since nobody desperately wants to use non-reserved keywords, nobody seems ready to use a word like INSTEAD instead. Ideally, a language

Re: Behavior of the for-else construct

2022-03-03 Thread Akkana Peck
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 always have to l

Re: Python

2022-03-03 Thread Dan Ciprus (dciprus) via Python-list
if OP formulates question the way he/she did, it's not worth to respond to it. There is plenty of similar questions in the archive. On Tue, Feb 22, 2022 at 07:07:54AM -0700, Mats Wichmann wrote: On 2/21/22 23:17, SASI KANTH REDDY GUJJULA wrote: Pip files are not installing after the python 3.1

Re: Behavior of the for-else construct

2022-03-03 Thread Jon Ribbens via Python-list
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 more > sensible name would

Re: Behavior of the for-else construct

2022-03-03 Thread Michael F. Stemper
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 used it

Re: Behavior of the for-else construct

2022-03-03 Thread computermaster360
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: Getting Syslog working on OSX Monterey

2022-03-03 Thread Philip Bloom via Python-list
Grabbing latest python that does work. Good we're about to get out of the stone ages a bit here. So findings: Syslog - works in 3.10, broken against monterey in 3.6. Logging.Handlers.Sysloghandler - is broken in both against Monterey. Will bug it for the tracker. Thanks for the feedback. On

Re: Getting Syslog working on OSX Monterey

2022-03-03 Thread Barry Scott
> On 3 Mar 2022, at 03:01, Philip Bloom wrote: > > I'm probably asking on the wrong list, and probably should bother wherever > apple's ASL experts live for changes in monterey. Guess nobody else is > seeing this? > > The same exact code is working just fine on OSX Big Sur, but on OSX Mont

Re: Timezone jokes (was: All permutations from 2 lists)

2022-03-03 Thread Avi Gross via Python-list
Chris and others, This is a bit off-topic, but for anyone who saw the recent remake of Around The World in 80 days (and of course earlier versions including the book) will see that it too is a sort of timezone joke! The timezone taketh away and then giveth. -Original Message- From: Ch

Re: Timezone jokes (was: All permutations from 2 lists)

2022-03-03 Thread Chris Angelico
On Fri, 4 Mar 2022 at 03:29, Tim Chase wrote: > > On 2022-03-03 06:27, Grant Edwards wrote: > > On 2022-03-03, Chris Angelico wrote: > > > Awww, I was going to make a really bad joke about timezones :) > > > > As opposed to all the really good jokes about timezones... ;) > > And here I thought yo

RE: Behavior of the for-else construct

2022-03-03 Thread Schachner, Joseph
Useful: On rare occasions (when a loop has a "break" in it) Used: Yes Know how it works: Yes Even is such a thing: Yes Your suggestion: Also useful. Will require a different keyword. I don't know what that would be. "finally" is available 😊 Write up a feature request. --- Joseph S. Tele

Re: Behavior of the for-else construct

2022-03-03 Thread Dieter Maurer
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

Re: Behavior of the for-else construct

2022-03-03 Thread Rob Cliffe via Python-list
It has occasional uses (I THINK I've used it myself) but spelling it `else` is very confusing.  So there have been proposals for an alternative spelling, e.g. `nobreak`. There have also been suggestions for adding other suites after `for', e.g.     if the loop WAS exited with `break`     if the

Re: Behavior of the for-else construct

2022-03-03 Thread Roel Schroeven
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 pe

Re: All permutations from 2 lists

2022-03-03 Thread Avi Gross via Python-list
Larry, That explanation made more sense and provided context. I fully agree with you that generating the cross product of multiple lists can be messy and large and best avoided. As an example, someone on an R forum presented their version of a way to see what are potential solutions to the gam

Re: Behavior of the for-else construct

2022-03-03 Thread Grant Edwards
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 else should be execute

Re: Behavior of the for-else construct

2022-03-03 Thread Tim Chase
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 yes-yes. It's extremely useful. Just

Re: Timezone jokes (was: All permutations from 2 lists)

2022-03-03 Thread Tim Chase
On 2022-03-03 06:27, Grant Edwards wrote: > On 2022-03-03, Chris Angelico wrote: > > Awww, I was going to make a really bad joke about timezones :) > > As opposed to all the really good jokes about timezones... ;) And here I thought you were just Trolling with timezones... https://en.wikipedi

Re: Behavior of the for-else construct

2022-03-03 Thread Barry Scott
> 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 know how it works, or that ther

Re: Behavior of the for-else construct

2022-03-03 Thread Chris Angelico
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's extremely useful. >

Re: Behavior of the for-else construct

2022-03-03 Thread Dan Stromberg
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 Python? > > I have used it

Re: All permutations from 2 lists

2022-03-03 Thread Rob Cliffe via Python-list
On 03/03/2022 14:07, Larry Martell wrote: On Wed, Mar 2, 2022 at 9:42 PM Avi Gross via Python-list wrote: Larry, i waited patiently to see what others will write and perhaps see if you explain better what you need. You seem to gleefully swat down anything offered. So I am not tempted to

Re: All permutations from 2 lists

2022-03-03 Thread Grant Edwards
On 2022-03-03, Chris Angelico wrote: > On Thu, 3 Mar 2022 at 13:05, gene heskett wrote: >> I take it back, kmail5 had decided it was a different thread. My bad, no >> biscuit. >> > > Awww, I was going to make a really bad joke about timezones :) As opposed to all the really good jokes about time

Re: All permutations from 2 lists

2022-03-03 Thread Larry Martell
On Wed, Mar 2, 2022 at 9:42 PM Avi Gross via Python-list wrote: > > Larry, > > i waited patiently to see what others will write and perhaps see if you > explain better what you need. You seem to gleefully swat down anything > offered. So I am not tempted to engage. But then you gave in to the t

Behavior of the for-else construct

2022-03-03 Thread 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? I have used it maybe once. My issue with this construct is that calling the second block `else` doesn't make sense;

Re: lxml empty versus self closed tag

2022-03-03 Thread Dieter Maurer
Robin Becker wrote at 2022-3-3 09:21 +: >On 02/03/2022 18:39, Dieter Maurer wrote: >> Robin Becker wrote at 2022-3-2 15:32 +: >>> I'm using lxml.etree.XMLParser and would like to distinguish >>> >>> >>> >>> from >>> >>> >>> >>> I seem to have e.getchildren()==[] and e.text==None for both

Re: lxml empty versus self closed tag

2022-03-03 Thread Robin Becker
On 02/03/2022 18:39, Dieter Maurer wrote: Robin Becker wrote at 2022-3-2 15:32 +: I'm using lxml.etree.XMLParser and would like to distinguish from I seem to have e.getchildren()==[] and e.text==None for both cases. Is there a way to get the first to have e.text=='' I do not think s