Re: How to solve the given problem?

2022-03-04 Thread Dennis Lee Bieber
On Fri, 4 Mar 2022 10:02:30 -0800 (PST), NArshad declaimed the following: >You have made everything too complicated. Just adjust the units left in the >second feed into the third and fourth feed because the fish is special and >that's it. The next day the second feed will be 100 units the way

Re: Behavior of the for-else construct

2022-03-04 Thread Cameron Simpson
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 the for-else (and

Re: Behavior of the for-else construct

2022-03-04 Thread Peter J. Holzer
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

Re: Behavior of the for-else construct

2022-03-04 Thread Avi Gross via Python-list
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 names and so on if UNICODE is being used properly. I can use my last

Re: Behavior of the for-else construct

2022-03-04 Thread Chris Angelico
On Sat, 5 Mar 2022 at 10:28, Peter J. Holzer wrote: > > On 2022-03-04 11:34:07 +1100, 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

Re: Behavior of the for-else construct

2022-03-04 Thread Peter J. Holzer
On 2022-03-04 11:34:07 +1100, 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

Re: Behavior of the for-else construct

2022-03-04 Thread Avi Gross via Python-list
Yes, Rob, I keep wondering how many decades it will take before people here understand how I make a point with an example that is not intended in any way to be complete or the way I would do it. No, I would not normally use the exception method, let alone in this case. This one practically scr

Re: Behavior of the for-else construct

2022-03-04 Thread Peter J. Holzer
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 %} >

Re: Behavior of the for-else construct

2022-03-04 Thread Peter J. Holzer
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

Re: Behavior of the for-else construct

2022-03-04 Thread Peter J. Holzer
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

Re: Behavior of the for-else construct

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

Re: Behavior of the for-else construct

2022-03-04 Thread Avi Gross via Python-list
Om (unless your first name is Joshi), Yes, your example captures some of my intent. I have not studied Django but your example suggests it uses special notation using a sort of set of braces like I have talked about "{%" and "%}" that allows freedom in using what might otherwise need keywords.

Re: Getting Syslog working on OSX Monterey

2022-03-04 Thread Peter J. Holzer
On 2022-02-28 22:05:05 +, Barry Scott wrote: > On 28 Feb 2022, at 21:41, Peter J. Holzer wrote: > > On 2022-02-27 22:16:54 +, Barry wrote: > >> I have always assumed that if I want a logger syslog handler that I would > >> have > >> to implement it myself. So far I have code that uses sys

Re: [python-uk] Fwd: It Will Never Work in Theory: live!

2022-03-04 Thread MRAB
On 2022-03-04 20:48, BELAHCENE Abdelkader wrote: hi, I receive a lot of email from the python-list, I want to disable it, when I want to read the email, I want to go to he List. Please How to disable it. Regards This page explains how to unsubscribe: https://mail.python.org/mailman/listinfo/p

Re: Behavior of the for-else construct

2022-03-04 Thread Michael F. Stemper
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,

Re: Behavior of the for-else construct

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

Re: Behavior of the for-else construct

2022-03-04 Thread Avi Gross via Python-list
Chris, My example was precisely what to do when it is an empty closet: > closet = [] > > attic = ["Costumes", "Sheets", "Shirts" ] > > for item in closet: >    print(item) >    if item == "Shirts" : print("FOUND in closet!!") > else: >    for item in attic: >        print(item) >        if i

Re: [python-uk] Fwd: It Will Never Work in Theory: live!

2022-03-04 Thread BELAHCENE Abdelkader
hi, I receive a lot of email from the python-list, I want to disable it, when I want to read the email, I want to go to he List. Please How to disable it. Regards Le jeu. 3 mars 2022 à 18:05, Steve Holden a écrit : > A communication from my good friend Greg Wilsin (instigator of the > Software

Re: Behavior of the for-else construct

2022-03-04 Thread 2QdxY4RzWzUUiLuE
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

Re: Behavior of the for-else construct

2022-03-04 Thread Om Joshi
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 %} and this seems to work quite well and be incredibly intuitive, a

Re: Behavior of the for-else construct

2022-03-04 Thread Avi Gross via Python-list
{NOTE, after some diversion, this long message does revert a bit to the topic.} Ah, Chris, the games we played when we were young and relatively immature! Has anyone else played with embedding "escape sequences" or other gimmicks in unexpected places like filenames so that on the right terminals

Re: Behavior of the for-else construct

2022-03-04 Thread Dennis Lee Bieber
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

Re: Behavior of the for-else construct

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

Re: Behavior of the for-else construct

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

Re: Behavior of the for-else construct

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

Re: Behavior of the for-else construct

2022-03-04 Thread Avi Gross via Python-list
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 range(0): print(eye) eye If I understand it, your example depends on a va

Re: Behavior of the for-else construct

2022-03-04 Thread Tim Chase
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

virtualenv and make DESTDIR=

2022-03-04 Thread Hartmut Goebel
Hi, How can I make installing a virtual environment honor DESTDIR? How can I install a virtual environment in $(DESTDIR)$(PREFIX), which behaves as being set-up in $(PREFIX)? (Of course, this virtual environment can not be used. My aim is to ship it as part of a rpm package) In Makefiles is

Re: Behavior of the for-else construct

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

Re: Behavior of the for-else construct

2022-03-04 Thread gene heskett
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 it, I ALWAYS put a comment > > >

Re: Behavior of the for-else construct

2022-03-04 Thread Roel Schroeven
Op 4/03/2022 om 1:43 schreef Chris Angelico: Think of it like this: for item in search_list: if condition: pass else: print("Condition not true for this item") for item in search_list: if condition: break else: print("Condition not true for any item") There's a par

Re: Behavior of the for-else construct

2022-03-04 Thread Roel Schroeven
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: > > ```pycon