Re: evaluation question

2023-02-07 Thread Chris Angelico
On Tue, 7 Feb 2023 at 18:49, Rob Cliffe via Python-list wrote: > > > > On 02/02/2023 09:31, mutt...@dastardlyhq.com wrote: > > On Wed, 1 Feb 2023 18:28:04 +0100 > > "Peter J. Holzer" wrote: > >> --b2nljkb3mdefsdhx > >> Content-Type: text/plain; charset=us-ascii > >> Content-Disposition: inline >

Re: DeprecationWarning but replacement doesn't work

2023-02-04 Thread Chris Angelico
On Sun, 5 Feb 2023 at 07:52, Chris Green wrote: > > I am using Image from PIL and I'm getting a deprecation warning as > follows:- > > /home/chris/bin/picShrink.py:80: DeprecationWarning: ANTIALIAS is deprecated > and will be removed in Pillow 10 (2023-07-01). Use Resampling.LANCZOS instead. > >

Re: evaluation question

2023-02-02 Thread Chris Angelico
On Fri, 3 Feb 2023 at 04:48, wrote: > Yeah ok :) But the ancestors of penguins didn't wake up one morning, flap > their wings and fall out the tree, it happened gradually. Python2 syntax > could have been retained for X versions of 3 just as C++ keeps old stuff > until its eventually deprecated

Re: evaluation question

2023-02-01 Thread Chris Angelico
On Thu, 2 Feb 2023 at 04:26, wrote: > > Its not evolution, its revolution. Evolution retains old functionality. > By the way, I'd like to see your opinions on eternal retention of old functionality. Which of these features are you willing to put effort into supporting? 1) Long integer constants

Re: evaluation question

2023-02-01 Thread Chris Angelico
On Thu, 2 Feb 2023 at 04:29, wrote: > > On Wed, 1 Feb 2023 11:59:25 +1300 > Greg Ewing wrote: > >On 31/01/23 10:24 pm, mutt...@dastardlyhq.com wrote: > >> All languages have their ugly corners due to initial design mistakes and/or > >> constraints. Eg: java with the special behaviour of its

Re: Upgrading Python on Ubuntu 22.04.1 LTS

2023-02-01 Thread Chris Angelico
‪On Thu, 2 Feb 2023 at 03:33, ‫אורי‬‎ wrote:‬ > > Hi, > > I have a server with Ubuntu 22.04.1 LTS and the Python version there > is Python 3.10.6. Is there a safe way to upgrade to the latest version of > Python 3.10 (3.10.9)? I tried with the OS update and upgrade but the Python > version

Re: evaluation question

2023-01-31 Thread Chris Angelico
On Wed, 1 Feb 2023 at 10:47, Greg Ewing wrote: > That's only one of the syntactic oddities of the old print > statement, thogh. There was also the >> thing, special treatment > of trailing commas, etc. "Soft space" (the trailing comma behaviour) was an incredibly complex wart. Glad it's gone. >

Re: Evaluation of variable as f-string

2023-01-31 Thread Chris Angelico
On Wed, 1 Feb 2023 at 09:14, Rob Cliffe via Python-list wrote: > With great respect, Chris, isn't it for the OP (or anyone else) to > decide - having been warned of the various drawbacks and limitations - > to decide if it's a terrible idea *for him*? He's entitled to decide > that it's just

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-28 Thread Chris Angelico
On Sun, 29 Jan 2023 at 14:29, Jach Feng wrote: > Thank you for detail explanation of the role the shell is involved in this > problem. I'm very appreciated! > > It seems that a CLI app may become very complex when dealing with different > kind of shell, and may not be possible to solve its

Re: Evaluation of variable as f-string

2023-01-28 Thread Chris Angelico
On Sun, 29 Jan 2023 at 14:36, Stefan Ram wrote: > > Johannes Bauer writes: > >I have a string. I want to evaluate it as if it were an f-string. I.e., > >there *are* obviously restrictions that apply (namely, the syntax and > >semantics of f-strings), but that's it. > > (This message was

Re: Usenet vs. Mailing-list

2023-01-28 Thread Chris Angelico
On Sun, 29 Jan 2023 at 12:07, Chris Green wrote: > > Chris Green wrote: > > Jon Ribbens wrote: > > > On 2023-01-28, Peter J. Holzer wrote: > > > > On 2023-01-27 21:04:58 +, Ben Bacarisse wrote: > > > >> It looks like you posted this question via Usenet. comp.lang.python is > > > >>

Re: Evaluation of variable as f-string

2023-01-28 Thread Chris Angelico
On Sun, 29 Jan 2023 at 11:56, Johannes Bauer wrote: > > Am 28.01.23 um 00:41 schrieb Chris Angelico: > > On Sat, 28 Jan 2023 at 10:08, Rob Cliffe via Python-list > > wrote: > >> > >> Whoa! Whoa! Whoa! > >> I appreciate the points you are m

Re: bool and int

2023-01-28 Thread Chris Angelico
On Sun, 29 Jan 2023 at 11:27, rbowman wrote: > > On Fri, 27 Jan 2023 21:35:11 -0800 (PST), Grant Edwards wrote: > > > In Unix shells, a return code of 0 is true and non-0 is false. > > That carries over to some C functions like strcmp() although it's more > complex. strcmp() returns the value of

Re: Evaluation of variable as f-string

2023-01-28 Thread Chris Angelico
On Sun, 29 Jan 2023 at 11:53, Johannes Bauer wrote: > I don't want to have to care about what quotation is used inside the > string, as long as it could successfully evaluate using the f-string > grammar. > Not possible. An f-string can contain other f-strings, and it is entirely possible to use

Re: logically Boolean

2023-01-28 Thread Chris Angelico
On Sun, 29 Jan 2023 at 04:33, wrote: > The right answer is that the question is too simple. It is what YOU want it > to be in your situation. And it is also what the LANGUAGE designers and > implementers have chosen within their domain. The REAL boolean is the friends we made along the way?

Re: bool and int

2023-01-27 Thread Chris Angelico
On Sat, 28 Jan 2023 at 11:45, Greg Ewing wrote: > > On 26/01/23 6:10 am, Chris Angelico wrote: > > And that's a consequence of a system wherein there is only one concept > > of "success", but many concepts of "failure". Whoever devised that > > system

Re: evaluation question

2023-01-27 Thread Chris Angelico
On Sat, 28 Jan 2023 at 11:45, wrote: > > Hi > > This is probably a dumb newbie question but I've just started to learn > python3 and eval() isn't behaving as I'd expect in that it works for > some things and not others. eg: > > >>> eval("1+1") > 2 > >>> eval("print(123)") > 123 > >>> eval("for i

Re: Evaluation of variable as f-string

2023-01-27 Thread Chris Angelico
On Sat, 28 Jan 2023 at 10:08, Rob Cliffe via Python-list wrote: > > Whoa! Whoa! Whoa! > I appreciate the points you are making, Chris, but I am a bit taken > aback by such forceful language. The exact same points have already been made, but not listened to. Sometimes, forceful language is

Re: Evaluation of variable as f-string

2023-01-27 Thread Chris Angelico
On Sat, 28 Jan 2023 at 05:31, Rob Cliffe via Python-list wrote: > On 23/01/2023 18:02, Chris Angelico wrote: > > Maybe, rather than asking for a way to treat a string as code, ask for > > what you ACTUALLY need, and we can help? > > > > ChrisA > Fair

Re: HTTP server benchmarking/load testing in Python

2023-01-26 Thread Chris Angelico
On Fri, 27 Jan 2023 at 14:21, Thomas Passin wrote: > 2. "What is Tjunction max temperature?" > Tjunction max is the maximum thermal junction temperature that a > processor will allow prior to using internal thermal control mechanisms > to reduce power and limit temperature. Activation of the

Re: bool and int

2023-01-26 Thread Chris Angelico
On Fri, 27 Jan 2023 at 06:32, Dino wrote: > > On 1/25/2023 5:42 PM, Chris Angelico wrote: > > > > > Try this (or its equivalent) in as many languages as possible: > > > > x = (1 > 2) > > x == 0 > > > > You'll find that x (which has effec

Re: HTTP server benchmarking/load testing in Python

2023-01-26 Thread Chris Angelico
On Fri, 27 Jan 2023 at 06:54, Thomas Passin wrote: > > Did you get a warning, or did you just decide to stop the test? > > (At least) one of the utilities, I forget which one, did show the > temperature in a danger zone. I'm very curious as to which utility, and on what basis it called it

Re: HTTP server benchmarking/load testing in Python

2023-01-26 Thread Chris Angelico
On Fri, 27 Jan 2023 at 04:31, Thomas Passin wrote: > > On 1/26/2023 11:41 AM, Chris Angelico wrote: > > On Fri, 27 Jan 2023 at 03:34, Thomas Passin wrote: > >> A nice theory but nothing to do with the real world. I've had a number > >> of laptops that overheat (o

Re: HTTP server benchmarking/load testing in Python

2023-01-26 Thread Chris Angelico
On Fri, 27 Jan 2023 at 03:34, Thomas Passin wrote: > A nice theory but nothing to do with the real world. I've had a number > of laptops that overheat (or would, if I let test program continue) > running this test program. Define "overheat". If all you're saying is "the fan began to whine and I

Re: bool and int

2023-01-26 Thread Chris Angelico
On Fri, 27 Jan 2023 at 03:31, rbowman wrote: > > On Thu, 26 Jan 2023 04:10:30 +1100, Chris Angelico wrote: > > > > BASIC was like that too, although it (at least, the versions I used in > > my childhood) didn't have "True" and "False", you just g

Re: bool and int

2023-01-26 Thread Chris Angelico
On Thu, 26 Jan 2023 at 21:53, Weatherby,Gerard wrote: > > I can’t help but wonder if there exists some Java forum /mailing list going > on about how horrible Python is. Try https://www.reddit.com/r/ProgrammerHumor/ for plenty of people whining about how horrible Python is. But along the way,

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-25 Thread Chris Angelico
On Thu, 26 Jan 2023 at 14:13, Jach Feng wrote: > Now I understand some oppose this idea and saying that you shouldn't use a > kitchen knife to cut a cake:-) You shouldn't use a chainsaw to cut a cake, and then ask us why cake-cutting is so noisy. ChrisA --

Re: HTTP server benchmarking/load testing in Python

2023-01-25 Thread Chris Angelico
On Thu, 26 Jan 2023 at 12:06, Thomas Passin wrote: > > On 1/25/2023 7:38 PM, Peter J. Holzer wrote: > > On 2023-01-25 16:30:56 -0500, Thomas Passin wrote: > >> Great! Don't forget what I said about potential overheating if you > >> hit the server with as many requests as it can handle. > > > >

Re: bool and int

2023-01-25 Thread Chris Angelico
On Thu, 26 Jan 2023 at 08:19, Dino wrote: > > On 1/23/2023 11:22 PM, Dino wrote: > > >>> b = True > > >>> isinstance(b,bool) > > True > > >>> isinstance(b,int) > > True > > >>> > > ok, I read everything you guys wrote. Everyone's got their reasons > obviously, but allow me to observe that

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-25 Thread Chris Angelico
On Thu, 26 Jan 2023 at 04:25, Jach Feng wrote: > > Chris Angelico 在 2023年1月25日 星期三下午1:16:25 [UTC+8] 的信中寫道: > > On Wed, 25 Jan 2023 at 14:42, Jach Feng wrote: > > > I was happy working with argparse during implement my script. To save the > > > typing, I used

Re: bool and int

2023-01-25 Thread Chris Angelico
On Thu, 26 Jan 2023 at 03:19, <2qdxy4rzwzuui...@potatochowder.com> wrote: > > Strongly disagree. There is PLENTY of practical value in using > > booleans as numbers. This is nothing to do with counting bytes, and > > everything to do with how useful it is in practice. > > IMO, the difference in

Re: bool and int

2023-01-25 Thread Chris Angelico
On Wed, 25 Jan 2023 at 22:55, <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 2023-01-25 at 12:14:50 +1100, > Chris Angelico wrote: > > > On Wed, 25 Jan 2023 at 10:32, <2qdxy4rzwzuui...@potatochowder.com> wrote: > > > > The usual complaint is tha

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-24 Thread Chris Angelico
On Wed, 25 Jan 2023 at 14:42, Jach Feng wrote: > I was happy working with argparse during implement my script. To save the > typing, I used a default equation for testing. > > sample = "-4^2+5.3*abs(-2-1)/2, abs(Abc)*(B+C)/D, (-3) * > sqrt(1-(x1/7)*(y1/7)) * sqrt(abs((x0-4.5)/(y0-4)))" > parser

Re: bool and int

2023-01-24 Thread Chris Angelico
On Wed, 25 Jan 2023 at 12:43, wrote: > Python has a different philosophy than some other languages with strong > typing. In some of those, you would not be allowed to add or multiply at > random but would need to convert parts of your calculation to all be the > same, such as a 32-bit integer.

Re: bool and int

2023-01-24 Thread Chris Angelico
On Wed, 25 Jan 2023 at 12:20, Mike Baskin via Python-list wrote: > > Will all of you please stop sending me emails Learn to manage your own mailing list subscription. HINT: Look at the *ENTIRE* email, not just the bit up the top that makes you angry. > Sent from my iPhone Ahh, I see the

Re: bool and int

2023-01-24 Thread Chris Angelico
On Wed, 25 Jan 2023 at 10:32, <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 2023-01-25 at 08:58:06 +1100, > Chris Angelico wrote: > > > On Wed, 25 Jan 2023 at 08:22, MRAB wrote: > > > For backwards compatibility, bool was made a subclass of int. >

Re: bool and int

2023-01-24 Thread Chris Angelico
On Wed, 25 Jan 2023 at 08:22, MRAB wrote: > For backwards compatibility, bool was made a subclass of int. Plus, it's really REALLY handy in quite a lot of situations. > > C# is pickier, which I guess is a good thing. > Nope, not a good thing. Actually a highly frustrating thing on those

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-23 Thread Chris Angelico
On Tue, 24 Jan 2023 at 13:09, Jach Feng wrote: > > Chris Angelico 在 2023年1月24日 星期二清晨5:00:27 [UTC+8] 的信中寫道: > > On Tue, 24 Jan 2023 at 07:47, Cameron Simpson wrote: > > > > > > But for Jach Feng: the "--" is really expected as something the user &g

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-23 Thread Chris Angelico
On Tue, 24 Jan 2023 at 07:47, Cameron Simpson wrote: > > But for Jach Feng: the "--" is really expected as something the user > does when they invoke your programme, _explicitly_ saying that what > follows from here is not an argument. So the user is expected to type: > > your_script -x -y

Re: Evaluation of variable as f-string

2023-01-23 Thread Chris Angelico
On Tue, 24 Jan 2023 at 04:56, Johannes Bauer wrote: > > Hi there, > > is there an easy way to evaluate a string stored in a variable as if it > were an f-string at runtime? > > ... > > This is supposedly for security reasons. However, when trying to emulate > this behavior that I wanted (and know

Re: To clarify how Python handles two equal objects

2023-01-14 Thread Chris Angelico
On Sun, 15 Jan 2023 at 11:38, Jen Kris wrote: > > Yes, in fact I asked my original question – "I discovered something about > Python array handling that I would like to clarify" -- because I saw that > Python did it that way. > Yep. This is not specific to arrays; it is true of all Python

Re: To clarify how Python handles two equal objects

2023-01-14 Thread Chris Angelico
On Sun, 15 Jan 2023 at 10:32, Jen Kris via Python-list wrote: > The situation I described in my original post is limited to a case such as x > = y ... the assignment can be done simply by "x" taking the pointer to "y" > rather than moving all the data from "y" into the memory buffer for "x" >

Re: file.read Method Documentation (Python 2.7.10)

2023-01-12 Thread Chris Angelico
On Thu, 12 Jan 2023 at 21:25, Stephen Tucker wrote: > > Chris, > > Thanks for this clarification. > > I have not found documentation that disagrees with you. I simply observe that > the documentation that I have alluded to earlier in this chain (section 5.9 > File Objects) That's specifically

Re: file.read Method Documentation (Python 2.7.10)

2023-01-11 Thread Chris Angelico
On Thu, 12 Jan 2023 at 04:31, Stephen Tucker wrote: > 1. Create BOM.txt > 2. Input three bytes at once from BOM.txt and print them > 3. Input three bytes one at a time from BOM.txt and print them All of these correctly show that a file, in binary mode, reads and writes bytes. > 4. Input three

Re: file.read Method Documentation (Python 2.7.10)

2023-01-11 Thread Chris Angelico
On Wed, 11 Jan 2023 at 21:31, Stephen Tucker wrote: > > Chris - > > In the Python 2.7.10 documentation, I am referring to section 5. Built-in > Types, subsection 5.9 File Objects. > > In that subsection, I have the following paragraph: > > file.read([size]) > > Read at most size bytes from the

Re: To clarify how Python handles two equal objects

2023-01-10 Thread Chris Angelico
On Wed, 11 Jan 2023 at 09:08, Thomas Passin wrote: > > Just to add a possibly picky detail to what others have said, Python > does not have an "array" type. It has a "list" type, as well as some > other, not necessarily mutable, sequence types. Just to be even pickier, Python DOES have an array

Re: To clarify how Python handles two equal objects

2023-01-10 Thread Chris Angelico
On Wed, 11 Jan 2023 at 07:41, Jen Kris wrote: > > > Thanks for your comments. I'd like to make one small point. You say: > > "Assignment in Python is a matter of object references. It's not > "conform them as long as they remain equal". You'll have to think in > terms of object references the

Re: To clarify how Python handles two equal objects

2023-01-10 Thread Chris Angelico
On Wed, 11 Jan 2023 at 07:14, Jen Kris via Python-list wrote: > > I am writing a spot speedup in assembly language for a short but > computation-intensive Python loop, and I discovered something about Python > array handling that I would like to clarify. > > For a simplified example, I created

Re: Mailing-Lists (pointer)

2023-01-09 Thread Chris Angelico
On Tue, 10 Jan 2023 at 09:37, dn wrote: > > On 10/01/2023 08.46, Stefan Ram wrote: > >If anyone is interested: In "comp.misc", there's a discussion > >about the use of mailing lists in software development. > >Subject: An objective criteria for deprecating community platforms > >

Re: file.read Method Documentation (Python 2.7.10)

2023-01-09 Thread Chris Angelico
On Tue, 10 Jan 2023 at 01:36, Stephen Tucker wrote: > > Dear Python-list, > > Yes, I know that Python 2.x is no longer supported. > > I have found that the documentation for this method is misleading when the > file being read is UTF-8-encoded: > >Instead of reading *size* bytes, the method

Re: subprocess equivalent for "os.execvp()"?

2023-01-08 Thread Chris Angelico
On Sun, 8 Jan 2023 at 21:51, wrote: > > Hello, > > is there an equivalent in the subprocess module for "os.execvp()" to > replace the current process with the new called one? It won't make a subprocess, so no. It's in the os module - under the name execvp. You found it already :) ChrisA --

Re: Recommendations in terms of threading, multi-threading and/or asynchronous processes/programming? - Sent Mail - Mozilla Thunderbird

2023-01-06 Thread Chris Angelico
On Sat, 7 Jan 2023 at 04:54, jacob kruger wrote: > > I am just trying to make up my mind with regards to what I should look > into working with/making use of in terms of what have put in subject line? > > > As in, if want to be able to trigger multiple/various threads/processes > to run in the

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-04 Thread Chris Angelico
On Thu, 5 Jan 2023 at 05:06, Barry Scott wrote: > > > On 03/01/2023 21:24, c.bu...@posteo.jp wrote: > > Am 03.01.2023 17:51 schrieb r...@zedat.fu-berlin.de: > >> logging.getLogger().addHandler( logging.StreamHandler( sys.stdout )) > > > > But I don't want to make all log levels go to stdout. Just

Re: No solution for "--verbose" (on stdout) output in Pythonds standard library?

2023-01-04 Thread Chris Angelico
On Thu, 5 Jan 2023 at 00:54, wrote: > > Hello, > > first I have to say that in my current and fresh humble opinion the > often seen "--verbose" switch in command line applications should > affect only the messages given to the users. This means messages on > "stdout". That is what this question

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Chris Angelico
On Wed, 4 Jan 2023 at 17:26, Eryk Sun wrote: > > On 1/3/23, Chris Angelico wrote: > > > > FDs can also be buffered. If it's buffering you want to avoid, don't > > mess around with exactly which one you're writing to, just flush. > > I meant to flush a C FILE stream

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Chris Angelico
On Wed, 4 Jan 2023 at 16:21, Grant Edwards wrote: > > On 2023-01-04, Chris Angelico wrote: > > On Wed, 4 Jan 2023 at 09:52, Grant Edwards > > wrote: > >> > >>> I can't think of a specific example, but I know I have piped the output > >>&

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Chris Angelico
On Wed, 4 Jan 2023 at 15:11, Eryk Sun wrote: > > On 1/3/23, Chris Angelico wrote: > > > > writing the FD is the same as using stdout > > Except stdout may be buffered. One should probably flush the buffer > before each raw write to the file descriptor. FDs ca

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Chris Angelico
On Wed, 4 Jan 2023 at 10:28, Stefan Ram wrote: > > c.bu...@posteo.jp writes: > >But I don't want to make all log levels go to stdout. Just DEBUG and > >INFO. > > The following was stripped down from something some guy > posted on a web site, maybe it was "rkachach". Yet another shining

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Chris Angelico
On Wed, 4 Jan 2023 at 09:52, Grant Edwards wrote: > > On 2023-01-03, Michael Torrie wrote: > > On 1/3/23 11:45, Keith Thompson wrote: > >> MRAB writes: > >> [...] > >>> The purpose of stderr is to display status messages, logging and error > >>> messages, even user prompts, and not mess up the

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Chris Angelico
On Wed, 4 Jan 2023 at 09:17, Michael Torrie wrote: > > On 1/3/23 11:45, Keith Thompson wrote: > > MRAB writes: > > [...] > >> The purpose of stderr is to display status messages, logging and error > >> messages, even user prompts, and not mess up the program's actual > >> output. This is

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Chris Angelico
On Wed, 4 Jan 2023 at 08:25, wrote: > > Am 03.01.2023 17:51 schrieb r...@zedat.fu-berlin.de: > > logging.getLogger().addHandler( logging.StreamHandler( sys.stdout )) > > But I don't want to make all log levels go to stdout. Just DEBUG and > INFO. But this would be a workaround. But why are DEBUG

Re: NoneType List

2022-12-31 Thread Chris Angelico
On Sun, 1 Jan 2023 at 15:16, wrote: > > Chris, > > There is much to say about consistent behavior as compared to flexibility > and convenience. > > I have seen other languages provide functions for example, where the result > can vary and often cause confusion. R had a function that would

Re: NoneType List

2022-12-31 Thread Chris Angelico
On Sun, 1 Jan 2023 at 14:19, wrote: > Had a language like that been created today, I wonder if some designs might > have looked a bit different so that some functions could be called with > optional arguments that specified what the user wanted returned. Frankly, I doubt it. While you can argue

Re: set.add() doesn't replace equal element

2022-12-30 Thread Chris Angelico
On Sat, 31 Dec 2022 at 09:29, Ian Pilcher wrote: > > On 12/30/22 15:47, Paul Bryan wrote: > > What kind of elements are being added to the set? Can you show > > reproducible sample code? > > The objects in question are DHCP leases. I consider them "equal" if > the lease address (or IPv6 prefix)

Re: set.add() doesn't replace equal element

2022-12-30 Thread Chris Angelico
On Sat, 31 Dec 2022 at 08:42, Ian Pilcher wrote: > > I just discovered this behavior, which is problematic for my particular > use. Is there a different set API (or operator) that can be used to > add an element to a set, and replace any equal element? > > If not, am I correct that I should call

Re: How make your module substitute a python stdlib module.

2022-12-27 Thread Chris Angelico
On Tue, 27 Dec 2022 at 23:28, Antoon Pardon wrote: > > > > Op 27/12/2022 om 13:09 schreef Chris Angelico: > > On Tue, 27 Dec 2022 at 23:06, Antoon Pardon wrote: > >>> How do you intend to distinguish one from the other? How should the > >>> logging

Re: How make your module substitute a python stdlib module.

2022-12-27 Thread Chris Angelico
On Tue, 27 Dec 2022 at 23:06, Antoon Pardon wrote: > > How do you intend to distinguish one from the other? How should the > > logging module know which threading module to use? > > That is my question! How can I get the logging module to use my module.I was > hoping the logging module would

Re: How make your module substitute a python stdlib module.

2022-12-27 Thread Chris Angelico
On Tue, 27 Dec 2022 at 22:13, Antoon Pardon wrote: > > > > Op 27/12/2022 om 11:37 schreef Chris Angelico: > > On Tue, 27 Dec 2022 at 21:29, Antoon Pardon wrote: > >> OK, I am writing an alternative for the threading module. What I would > >> like to know i

Re: How make your module substitute a python stdlib module.

2022-12-27 Thread Chris Angelico
On Tue, 27 Dec 2022 at 21:29, Antoon Pardon wrote: > > OK, I am writing an alternative for the threading module. What I would > like to know is how I can get some library modules call my alternative > instead of the threading module. > > For instance there is the logging module, it can log the

Re: How to enter escape character in a positional string argumentfrom the command line?

2022-12-21 Thread Chris Angelico
On Thu, 22 Dec 2022 at 04:12, Barry wrote: > I see bash scripts that are 1000’s of line of code at work and its a > maintenance nightmare. > > Knowing when to make the move from “handy bash script” to “this is a > production application” and needs to be python is what I see people miss. > >

Re: How to enter escape character in a positional string argumentfrom the command line?

2022-12-21 Thread Chris Angelico
On Thu, 22 Dec 2022 at 03:58, gene heskett wrote: > > On 12/21/22 11:22, Chris Angelico wrote: > > On Thu, 22 Dec 2022 at 03:11, Stefan Ram wrote: > >> > >> Lars Liedtke writes: > >>> Or you could have "native" bash ($SHELL) with WSL. > >

Re: How to enter escape character in a positional string argument from the command line?

2022-12-21 Thread Chris Angelico
On Thu, 22 Dec 2022 at 03:11, Stefan Ram wrote: > > Lars Liedtke writes: > >Or you could have "native" bash ($SHELL) with WSL. > > In this newsgroup, it would actually be obvious to use Python. Less obvious than you might think - partly because bash is just so dang good that it's really

Re: How to enter escape character in a positional string argument from the command line?

2022-12-21 Thread Chris Angelico
On Thu, 22 Dec 2022 at 03:11, Jach Feng wrote: > > Chris Angelico 在 2022年12月21日 星期三下午1:02:01 [UTC+8] 的信中寫道: > > On Wed, 21 Dec 2022 at 15:28, Jach Feng wrote: > > > That's what I am taking this path under Windows now, the ultimate > > > solution before Win

Re: How to enter escape character in a positional string argument from the command line?

2022-12-21 Thread Chris Angelico
On Wed, 21 Dec 2022 at 23:16, Albert-Jan Roskam wrote: > > > > On Dec 21, 2022 06:01, Chris Angelico wrote: > > On Wed, 21 Dec 2022 at 15:28, Jach Feng wrote: > > That's what I am taking this path under Windows now, the ultimate solution > > before Win

Re: How to enter escape character in a positional string argument from the command line?

2022-12-20 Thread Chris Angelico
On Wed, 21 Dec 2022 at 15:28, Jach Feng wrote: > That's what I am taking this path under Windows now, the ultimate solution > before Windows has shell similar to bash:-) Technically, Windows DOES have a shell similar to bash. It's called bash. :) The trouble is, most people use cmd.exe instead.

Re: Fwd: Installation hell

2022-12-19 Thread Chris Angelico
On Tue, 20 Dec 2022 at 10:01, Thomas Passin wrote: > > On 12/19/2022 5:16 PM, Chris Angelico wrote: > > On Tue, 20 Dec 2022 at 09:12, Thomas Passin wrote: > >> FWIW, I once set up a Python installation so that it could run from a > >> USB stick (Windows only).

Re: Fwd: Installation hell

2022-12-19 Thread Chris Angelico
On Tue, 20 Dec 2022 at 09:12, Thomas Passin wrote: > FWIW, I once set up a Python installation so that it could run from a > USB stick (Windows only). My launcher was a batch file that contained > the following: > > @echo off > setlocal > : Find effective drive for this file. > set ed=%~d0 >

Re: Installation hell

2022-12-19 Thread Chris Angelico
On Tue, 20 Dec 2022 at 04:14, Thomas Passin wrote: > > On 12/19/2022 11:36 AM, Chris Angelico wrote: > > On Tue, 20 Dec 2022 at 03:05, Thomas Passin wrote: > >> > >> That's not been my experience. Windows installers for Python have > >> worked well

Re: Installation hell

2022-12-19 Thread Chris Angelico
On Tue, 20 Dec 2022 at 03:56, Peter J. Holzer wrote: > > It is however, quite noticable that almost everyone who asks a question > about their Python installation on this list is using Windows. I don't > think this is just because there are more Windows users than Linux or > Mac Users. Yes. I

Re: Installation hell

2022-12-19 Thread Chris Angelico
On Tue, 20 Dec 2022 at 03:05, Thomas Passin wrote: > > That's not been my experience. Windows installers for Python have > worked well for me over many generations of Python releases. It's Linux > where I've found difficulties. For example, if your distro's Python > install didn't include

Re: pip/setuptools: Entry points not visible from pkexec-root-environment

2022-12-19 Thread Chris Angelico
On Mon, 19 Dec 2022 at 19:38, wrote: > > Dear Chris, > thanks for asking back and my apologize for being to broad in my way of > asking (in a foreign language). > > Am 19.12.2022 07:40 schrieb Chris Angelico: > > Hmm, then I'm not sure what you're *losing* here. The prob

Re: pip/setuptools: Entry points not visible from pkexec-root-environment

2022-12-18 Thread Chris Angelico
On Mon, 19 Dec 2022 at 17:30, wrote: > > Am 18.12.2022 22:37 schrieb Mats Wichmann: > > the which command uses your PATH, so I'm not sure you're buying > > anything new there > > I'm using which before entering pkexec. ;) > > I'll show a demonstrator project later. Hmm, then I'm not sure

Re: String to Float, without introducing errors

2022-12-18 Thread Chris Angelico
On Mon, 19 Dec 2022 at 07:57, Stefan Ram wrote: > G = Decimal( 6.6743015E-11 ) > r = Decimal( 6.371E6 ) > M = Decimal( 5.9722E24 ) What's the point of using Decimal if you start with nothing more than float accuracy? ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: pip/setuptools: Entry points not visible from pkexec-root-environment

2022-12-18 Thread Chris Angelico
On Mon, 19 Dec 2022 at 04:56, wrote: > > Hello, > > when I install a package on a GNU/Linux system via "sudo python3 -m pip > install -e ." that defines entry points in its pyproject.toml the entry > point starter scripts are located in /usr/locale/bin. > > That folder is in PATH for "regular"

Re: Fwd: Installation hell

2022-12-18 Thread Chris Angelico
On Mon, 19 Dec 2022 at 06:10, Mats Wichmann wrote: > Why? Python is a command-line tool to process a language, Similar to > many other languages - Go, for example. Or a C/C++ compiler. *Or* you > can choose to use someone's wrapping of that process inside an > Integrated Development

Re: Single line if statement with a continue

2022-12-17 Thread Chris Angelico
On Sun, 18 Dec 2022 at 10:59, wrote: > > If a compiler or interpreter HAPPILY (as happy as machines/code get) compiles > or interprets your code without errors every time you use it a certain way, > then it is not wrong to use it. Of course if it subject to change or already > deprecated, ...

Re: String to Float, without introducing errors

2022-12-17 Thread Chris Angelico
On Sun, 18 Dec 2022 at 09:46, Stefan Ram wrote: > > Grant Edwards writes: > >Yes, fixed point (or decimal) is a better fit for what he's doing. but > >I suspect that floating point would be a better fit for the problem > >he's trying to solve. > > I'd like to predict that within the next ten

Re: String to Float, without introducing errors

2022-12-17 Thread Chris Angelico
On Sun, 18 Dec 2022 at 08:22, Grant Edwards wrote: > > On 2022-12-17, Chris Angelico wrote: > > >> It was the rounding rounding error that I needed to avoid (as Peter > >> J. Holzer suggested). The use of decimal solved it and just in > >> time. I was ab

Re: String to Float, without introducing errors

2022-12-17 Thread Chris Angelico
On Sun, 18 Dec 2022 at 07:46, Paul St George wrote: > > Thanks to all! > It was the rounding rounding error that I needed to avoid (as Peter J. Holzer > suggested). The use of decimal solved it and just in time. I was about to > truncate the number, get each of the characters from the string

Re: Single line if statement with a continue

2022-12-14 Thread Chris Angelico
On Thu, 15 Dec 2022 at 16:29, Thomas Passin wrote: > > PEP-8, which is Guido's style guide and generally good to follow, does > not completely discourage single-line usage like the example. It's not > clear to me how Chris's example fits into the guidelines. > > PEP-8: > "While sometimes it’s

Re: Single line if statement with a continue

2022-12-14 Thread Chris Angelico
On Thu, 15 Dec 2022 at 14:41, Aaron P wrote: > > I occasionally run across something like: > > for idx, thing in enumerate(things): > if idx == 103: > continue > do_something_with(thing) > > It seems more succinct and cleaner to use: > > if idx == 103: continue. > > Of course this

Re: sqlite3 double quote behavior

2022-12-13 Thread Chris Angelico
On Wed, 14 Dec 2022 at 08:19, Roel Schroeven wrote: > > Chris Angelico schreef op 13/12/2022 om 20:01: > > On Wed, 14 Dec 2022 at 06:00, Roel Schroeven wrote: > > > > > > Stefan Ram schreef op 13/12/2022 om 8:42: > > > > "John K. Parejko" wr

Re: sqlite3 double quote behavior

2022-12-13 Thread Chris Angelico
On Wed, 14 Dec 2022 at 06:00, Roel Schroeven wrote: > > Stefan Ram schreef op 13/12/2022 om 8:42: > > "John K. Parejko" writes: > > >I was just burned by this, where some tests I’d written > > >against an sqlite database did not fail in the way that they > > >“should” have, because of this

Re: Top level of a recursive function

2022-12-13 Thread Chris Angelico
On Wed, 14 Dec 2022 at 05:01, Mats Wichmann wrote: > > On 12/13/22 10:36, Chris Angelico wrote: > > On Wed, 14 Dec 2022 at 03:35, Michael F. Stemper > > wrote: > >> > >> It's easy enough -- in fact necessary -- to handle the bottom > >> level of

Re: Top level of a recursive function

2022-12-13 Thread Chris Angelico
On Wed, 14 Dec 2022 at 03:35, Michael F. Stemper wrote: > > It's easy enough -- in fact necessary -- to handle the bottom > level of a function differently than the levels above it. What > about the case where you want to handle something differently > in the top level than in lower levels? Is

Re: sqlite3 double quote behavior

2022-12-13 Thread Chris Angelico
On Wed, 14 Dec 2022 at 00:30, Thomas Passin wrote: > > On 12/13/2022 4:09 AM, Chris Angelico wrote: > > On Tue, 13 Dec 2022 at 19:52, Roel Schroeven wrote: > >> Like Lars Liedtke this is not an exact answer to your question, but you > >> can side-step the issue by u

Re: sqlite3 double quote behavior

2022-12-13 Thread Chris Angelico
On Tue, 13 Dec 2022 at 19:52, Roel Schroeven wrote: > Like Lars Liedtke this is not an exact answer to your question, but you > can side-step the issue by using parametrized queries, i.e. instead of > > cur.execute('SELECT name, location FROM persons WHERE name = "John > Doe"') > > do > >

Re: Does one have to use curses to read single characters from keyboard?

2022-12-11 Thread Chris Angelico
On Mon, 12 Dec 2022 at 09:24, Barry Scott wrote: > You would need to have a loop that collected all the utf-8 bytes of a single > code point. > You can to look at the first byte of know if the utf-8 is 1, 2, 3 or 4 bytes > for a code point. And cope with escape sequences too - if you press an

Re: FTP without username and password

2022-12-06 Thread Chris Angelico
On Wed, 7 Dec 2022 at 02:51, ^Bart wrote: > > Hi Guys, > > usually I use this code on my Debian Bullseye: > > # python3 -m pyftpdlib -i 192.168.0.71 -p 21 -d /home/my_user/ftp > > It works, it's simply easy and perfect but... a device in my lan needs a > ftp folder without username and password!

Re: argparse — adding a --version flag in the face of positional args

2022-11-28 Thread Chris Angelico
On Tue, 29 Nov 2022 at 12:37, Loris Bennett wrote: > > Mats Wichmann writes: > > > On 11/27/22 16:40, Skip Montanaro wrote: > >> I have a script to which I'd like to add a --version flag. It should print > >> the version number then exit, much in the same way --help prints the help > >> text

<    1   2   3   4   5   6   7   8   9   10   >