Re: Conda create with python version fails me

2025-11-17 Thread Martin Schöön via Python-list
Den 2025-11-14 skrev Stefan Ram : > Martin =?UTF-8?Q?Sch=C3=B6=C3=B6n?= wrote or quoted: >>If I try to specify a python version I don't get a new environment. The >>error message I get is: >>"The following packages are missing from the target environment: >> - python=3.10" >> (if I asked for ver

Re: Sending FDs over UNIX domain sockets

2025-11-15 Thread Grant Edwards via Python-list
On 2025-11-16, Pokemon Chw via Python-list wrote: > On Linux AF_UNIX + SOCK_STREAM sockets, there is a quirk in how the > kernel handles control messages with SCM_RIGHTS: > > To successfully pass file descriptors via SCM_RIGHTS, you must send > at least one byte of normal data in the same sendmsg

Re: zipapp: add compression (method), compresslevel options from Zipfile

2025-11-15 Thread Abdur-Rahmaan Janhangeer via Python-list
You have some demo code for it? Kind Regards, Abdur-Rahmaan Janhangeer about | blog github Mauritius On Mon, 10 Nov 2025, 07:18 Mingye Wang via Python-list, < [email protected]>

Re: Conda create with python version fails me

2025-11-14 Thread Martin Schöön via Python-list
Den 2025-11-13 skrev Loris Bennett : Hi Loris, Thanks for quick respons. > Martin Schöön writes: > >> >> I want to create a new environment using a specific python version >> rather than leaving that to conda. Cheat-sheets and online conda >> documentation tell me to use: >> >> conda create -n

Re: Conda create with python version fails me

2025-11-13 Thread Loris Bennett
Hi Martin, Martin Schöön writes: > About two years ago I moved from pip to conda. I have been happy with > conda until yesterday. > > I want to create a new environment using a specific python version > rather than leaving that to conda. Cheat-sheets and online conda > documentation tell me to

Re: argsparse: allowing --version without mandatory options

2025-11-04 Thread Jonathan N. Little via Python-list
Loris Bennett wrote: > "Loris Bennett" writes: > >> Hi, >> >> I am writing a program for the command-line which uses 'argsparse'. I >> want to make some options mandatory by setting 'required=True', but >> still allow the program to run with the option '--version' (which just >> shows the versio

Re: argsparse: allowing --version without mandatory options

2025-11-02 Thread Peter J. Holzer
On 2025-10-30 13:47:16 -0400, [email protected] wrote: > On 2025-10-30 at 13:50:42 +0100, > Loris Bennett wrote: > > "Loris Bennett" writes: > > > I am writing a program for the command-line which uses 'argsparse'. I > > > want to make some options mandatory by setting 'required

Re: argsparse: allowing --version without mandatory options

2025-10-31 Thread Daniel Sommers
On 2025-10-31 at 09:09:08 +, Anders Munch wrote: > From: [email protected] <[email protected]>: > > Don't take this the wrong way, but what, exactly, is a mandatory option? > > It's a named argument. Okay. > Positional arguments intermixed with options can

Re: argsparse: allowing --version without mandatory options

2025-10-31 Thread Anders Munch
From: [email protected] <[email protected]>: > Don't take this the wrong way, but what, exactly, is a mandatory option? It's a named argument. Positional arguments intermixed with options can get confusing. When you see aprogram.py --a --b c --d --e is 'c' t

Re: argsparse: allowing --version without mandatory options

2025-10-30 Thread Mats Wichmann
On 10/30/25 11:47, [email protected] wrote: On 2025-10-30 at 13:50:42 +0100, Don't take this the wrong way, but what, exactly, is a mandatory option? Perhaps an argument that must be given in order to specify a value that has no default (not that I'd do that, personally). O

Re: argsparse: allowing --version without mandatory options

2025-10-30 Thread 2QdxY4RzWzUUiLuE
On 2025-10-30 at 13:50:42 +0100, Loris Bennett wrote: > "Loris Bennett" writes: > > I am writing a program for the command-line which uses 'argsparse'. I > > want to make some options mandatory by setting 'required=True', but > > still allow the program to run with the option '--version' (whic

Re: argsparse: allowing --version without mandatory options

2025-10-30 Thread Loris Bennett
"Loris Bennett" writes: > Hi, > > I am writing a program for the command-line which uses 'argsparse'. I > want to make some options mandatory by setting 'required=True', but > still allow the program to run with the option '--version' (which just > shows the version and then exits) even if the m

Re: Formatted Integer With Specified Number Of Digits

2025-10-26 Thread Michael Torrie via Python-list
On 10/24/25 4:38 AM, Alan Bawden wrote: > Paul Rubin writes: > >Lawrence D’Oliveiro writes: >> >>> "%#0.3x" % 2 >> '0x002' > >f'0x{2:03x} > > Won't work for negative numbers. That's true. For negative numbers the padding would have to be Fs instead of 0s. -- https:/

Re: Formatted Integer With Specified Number Of Digits

2025-10-24 Thread Alan Bawden
Paul Rubin writes: Lawrence D’Oliveiro writes: > >>> "%#0.3x" % 2 > '0x002' f'0x{2:03x} Won't work for negative numbers. -- Alan Bawden -- https://mail.python.org/mailman3//lists/python-list.python.org

Re: Proposal to update Unicode handling for German sharp S (ß / ẞ) in Python’s case conversion methods

2025-10-22 Thread Michael Torrie via Python-list
On 10/22/25 7:14 PM, Chris Angelico via Python-list wrote: > And that's why it's so frustrating when someone bases their entire > argument on an AI's nonsense. If the OP had simply posted it as a > request, with no hallucinated claims, it would have been a > straight-forward matter to explain the U

Re: Proposal to update Unicode handling for German sharp S (ß / ẞ) in Python’s case conversion methods

2025-10-22 Thread Chris Angelico via Python-list
On Thu, 23 Oct 2025 at 12:01, Michael Torrie via Python-list wrote: > > On 10/19/25 12:38 PM, Chris Angelico via Python-list wrote: > > The entire premise of your post was flat-out wrong. Your data was > > nothing but hallucinations, and there is nothing to discuss. I'm not > > even going to bothe

Re: Proposal to update Unicode handling for German sharp S (ß / ẞ) in Python’s case conversion methods

2025-10-22 Thread Michael Torrie via Python-list
On 10/19/25 12:38 PM, Chris Angelico via Python-list wrote: > The entire premise of your post was flat-out wrong. Your data was > nothing but hallucinations, and there is nothing to discuss. I'm not > even going to bother reading further, because every post you've > written smells like AI slop. In

Re: Formatted Integer With Specified Number Of Digits

2025-10-19 Thread songbird
Lawrence D’Oliveiro wrote: > Formatting an integer with 3 digits, excluding base specifier: > > >>> "%#0.3x" % 2 > '0x002' > > No equivalent to this in any of the other ways that Python allows for > formatting: > > >>> format(2, "#03x") > '0x2' > > (Not what I want) > > >>>

Re: Proposal to update Unicode handling for German sharp S (ß / ẞ) in Python’s case conversion methods

2025-10-19 Thread Chris Angelico via Python-list
On Mon, 20 Oct 2025 at 02:01, wrote: > > Thanks again for your detailed reply — I really appreciate it. I have to > admit, I wasn’t 100% sure about my data, which is why I submitted it for > discussion before opening a bug report to the Python developers. > Don't. Don't open a discussion based

Re: Proposal to update Unicode handling for German sharp S (ß / ẞ) in Python’s case conversion methods

2025-10-19 Thread python
Thanks again for your detailed reply — I really appreciate it. I have to admit, I wasn’t 100% sure about my data, which is why I submitted it for discussion before opening a bug report to the Python developers. I alredy checked Unicode tables, I saw that the capital ß (U+1E9E) was already encod

Re: Proposal to update Unicode handling for German sharp S (ß / ẞ) in Python’s case conversion methods

2025-10-18 Thread Chris Angelico via Python-list
On Sun, 19 Oct 2025 at 11:03, wrote: > > Thanks Chris for the response! > > As The Unicode Standard does define an uppercase form for the German sharp S > (U+00DF → U+1E9E), and this has been part of Unicode since version 5.1 > (2008), with the German orthography officially adopting it in 2017.

Re: Proposal to update Unicode handling for German sharp S (ß / ẞ) in Python’s case conversion methods

2025-10-18 Thread python
Thanks Chris for the response! As The Unicode Standard does define an uppercase form for the German sharp S (U+00DF → U+1E9E), and this has been part of Unicode since version 5.1 (2008), with the German orthography officially adopting it in 2017. The relevant case mappings are clearly specified

Re: Slices by length

2025-10-18 Thread Rob Cliffe via Python-list
On 06/09/2025 17:21, MRAB wrote: On 2025-09-06 13:47, Rob Cliffe via Python-list wrote: I quite often find myself writing expressions of the form       someString[x : x+n] where n is often an int and x may be an int, a variable, or a (possibly complicated) expression. It would be more natural

Re: Proposal to update Unicode handling for German sharp S (ß / ẞ) in Python’s case conversion methods

2025-10-18 Thread Mashaal Al Hammdi via Python-list
Hello friends, Can I know what’s going on?! Please في سبت، 18 أكتوبر، 2025 في 7:11 ص، كتب Chris Angelico via Python-list < [email protected]>: > On Sat, 18 Oct 2025 at 13:44, wrote: > > > > Dear Python Developers, > > > > I would like to bring attention to an inconsistency and legacy behavi

Re: Slices by length

2025-10-18 Thread Richard Damon
Sent from my iPad > On Oct 7, 2025, at 9:59 PM, Rob Cliffe via Python-list > wrote: > > In fairness, it is already possible to write > s[x:][:n] > which gives the "right" answer if n is non-negative, and is quite readable, > although this is slower than s[x:x+2], at least in tests that I

Re: Slices by length

2025-10-18 Thread MRAB
On 08/10/2025 03:21, Richard Damon wrote: Sent from my iPad On Oct 7, 2025, at 9:59 PM, Rob Cliffe via Python-list wrote: In fairness, it is already possible to write s[x:][:n] which gives the "right" answer if n is non-negative, and is quite readable, although this is slower than s[

Re: Python 3.14.0 (final) is here!

2025-10-18 Thread Ed Leafe via Python-list
On Oct 7, 2025, at 13:14, Abdur-Rahmaan Janhangeer via Python-list wrote: > > Very sad ... At least as Steve Dower suggested even if we could get an > email from Discourse or something. I too will miss these announcements. I understand not having to post things to multiple places, but forwardi

Re: Python 3.14.0 (final) is here!

2025-10-18 Thread Karsten Hilbert via Python-list
Am Wed, Oct 08, 2025 at 10:51:42AM +0200 schrieb Jean-François Bachelet via Python-list: > at least a mailing list is way more frugal. and internet friendly. And above all, PUSH rather than PULL. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mai

Re: Slices by length

2025-10-18 Thread Rob Cliffe via Python-list
On 07/10/2025 20:37, Thomas Passin wrote: On 10/7/2025 2:49 PM, Rob Cliffe via Python-list wrote: On 06/09/2025 17:21, MRAB wrote: On 2025-09-06 13:47, Rob Cliffe via Python-list wrote: I quite often find myself writing expressions of the form       someString[x : x+n] where n is often an

Re: Slices by length

2025-10-18 Thread Thomas Passin
On 10/7/2025 2:49 PM, Rob Cliffe via Python-list wrote: On 06/09/2025 17:21, MRAB wrote: On 2025-09-06 13:47, Rob Cliffe via Python-list wrote: I quite often find myself writing expressions of the form       someString[x : x+n] where n is often an int and x may be an int, a variable, or a (po

Re: Proposal to update Unicode handling for German sharp S (ß / ẞ) in Python’s case conversion methods

2025-10-17 Thread Chris Angelico via Python-list
On Sat, 18 Oct 2025 at 13:44, wrote: > > Dear Python Developers, > > I would like to bring attention to an inconsistency and legacy behavior > regarding the handling of the German sharp S characters in Python’s string > case conversion methods. > This isn't Python's decision. The definition of

Re: Python 3.14.0 (final) is here!

2025-10-17 Thread Jean-François Bachelet via Python-list
Hello Python Team ^^) It's indeed VERY sad that you would kill these mailing list !  we are a lot NOT using hungry ressources stuff like discuss, discord, or others that require a web browser to read at least a mailing list is way more frugal. and internet friendly. Cheers, Jeff Le 07

Re: Slices by length

2025-10-08 Thread meowxiik via Python-list
dy 'help' to > [email protected] > >You can reach the person managing the list at > [email protected] > >When replying, please edit your Subject line so it is more specific >than "Re: Contents of Python-list digest..." -- https://mail.python.org/mailman3//lists/python-list.python.org

Re: Python 3.14.0 (final) is here!

2025-10-07 Thread Abdur-Rahmaan Janhangeer via Python-list
Very sad ... At least as Steve Dower suggested even if we could get an email from Discourse or something. Kind Regards, Abdur-Rahmaan Janhangeer about | blog github Mauritius On Tue,

Re: Detailed documentation or specs for behavior of descriptors in attributes of metaclasses

2025-09-26 Thread Steve Jorgensen via Python-list
In case anyone stumbles upon this, here's my question and partial self-answer on Stack Overflow: https://stackoverflow.com/a/79765602/396373 -- https://mail.python.org/mailman3//lists/python-list.python.org

Re: can you improve this text-only beginner copy program?

2025-09-25 Thread Peter J. Holzer
On 2025-08-28 21:15:11 +0100, Mark Bourne wrote: > I don't know if Sphinx can extract types from type hints but, at least if > the docstring is just for humans reading the code, using those can reduce > the markup in the docstring: > ``` > def copy(s: int, d: int) -> None: > """ > Copy the

Re: Test message. Posted a question several days ago and don't see it.

2025-09-20 Thread Ethan Furman
On 9/10/25 21:15, Steve Jorgensen via Python-list wrote: > I posted a question here several days ago and received a "Welcome to the "Python-list" mailing list!" > email, but I still don't see my question in the list. > > I'm posting this mainly to see if it shows up, or I get a reply from a mod

Re: Test message. Posted a question several days ago and don't see it.

2025-09-12 Thread Steve Jorgensen via Python-list
Well, that was the more important thing to do. :) -- https://mail.python.org/mailman3//lists/python-list.python.org

Re: Python: The Documentary | An Origin Story

2025-09-12 Thread Ethan Carter
Lawrence D’Oliveiro writes: > Interviews with GvR and many others about their part in the origins and > rise to prominence of what currently seems to be the world’s most popular > programming language. In 4K! > > Thanks. FWIW, the Computer History

Re: staticmethod(cls)

2025-09-12 Thread Mats Wichmann
On 9/4/25 13:28, Pierre Asselin wrote: For reasons I won't go into I ended up defining classes inside of a class body. That's not in the manual, but I see no reason it would fail. Nested classes certainly work. I've seen them used quite a bit in testing code, where you may want an object which

Re: an adventure: a Lisp-style linked list

2025-09-10 Thread Ethan Carter
[email protected] (Pierre Asselin) writes: > Ethan Carter wrote: > >> def __init__(self, d, ls): >> self.head = d >> self.tail = ls > > Why not > def __init__(self, d, ls=None): > > and avoid the need for a List.Empty ? Thanks! That's a good suggestion. -- https://mail.pyt

Re: Test message. Posted a question several days ago and don't see it.

2025-09-10 Thread dn via Python-list
Hi Steve, ask away... On 11/09/25 16:15, Steve Jorgensen via Python-list wrote: I posted a question here several days ago and received a "Welcome to the "Python-list" mailing list!" email, but I still don't see my question in the list. I'm posting this mainly to see if it shows up, or I get a

Re: Drop into REPL when your program crashes.

2025-09-10 Thread Ethan Carter
Annada Behera writes: > Hi, > > Recently I have been increasingly adding this piece of code as > a preamble to a lot of my code. > > import (sys, os, ipdb) > > def debug_hook(exc_type, exc_value, traceback): > if exc_type is KeyboardInterrupt: > sys.__excepthook__(exc_

Re: Drop into REPL when your program crashes.

2025-09-10 Thread Annada Behera via Python-list
So, ipdb is the ipython version of pdb. In fact, post_mortem is a pdb function. I use ipdb because its REPL is a bit nicer to work with then pdb. -Original Message- From: Stefan Ram Subject: Re: Drop into REPL when your program crashes. Date: 09/08/2025 06:04:16 PM Newsgroups

Re: an adventure: a Lisp-style linked list

2025-09-10 Thread Pierre Asselin
Ethan Carter wrote: > def __init__(self, d, ls): > self.head = d > self.tail = ls Why not def __init__(self, d, ls=None): and avoid the need for a List.Empty ? -- pa at panix dot com -- https://mail.python.org/mailman3//lists/python-list.python.org

Re: Slices by length

2025-09-06 Thread dn via Python-list
On 7/09/25 00:47, Rob Cliffe via Python-list wrote: I quite often find myself writing expressions of the form     someString[x : x+n] where n is often an int and x may be an int, a variable, or a (possibly complicated) expression. 0 A PEP 1 A helper-function eg slice_by_length( input_string

Re: Slices by length

2025-09-06 Thread MRAB
On 2025-09-06 13:47, Rob Cliffe via Python-list wrote: I quite often find myself writing expressions of the form     someString[x : x+n] where n is often an int and x may be an int, a variable, or a (possibly complicated) expression. It would be more natural to be able to specify the slice not

Re: Error installing matplotlib

2025-09-05 Thread Rob Cliffe via Python-list
On 03/09/2025 15:45, Oscar Benjamin wrote: On Wed, 3 Sep 2025, 15:40 Rob Cliffe, wrote: On 03/09/2025 15:35, Oscar Benjamin wrote: On Wed, 3 Sep 2025, 15:21 Rob Cliffe via Python-list, wrote: On 03/09/2025 14:59, Mats Wichmann wrote: > On 9/3/25 07:20, R

Re: Environments and Version Control (if not packaging and PyPI)

2025-09-04 Thread Left Right via Python-list
I record the URLs used by pip to download the packages that I managed to get to work, and during CI / routine development, I'd use a script to re-download the packages from those URLs, skipping all and any interactions with pip (or uv). This makes it a lot faster and, more importantly, a lot more

Re: Image enhance

2025-09-03 Thread MRAB
On 2025-09-03 13:06, AM CR via Python-list wrote: Good morning everyone. First of all, thank you in advance for your advice and suggestions. After a few attempts, I've come to the conclusion that working on Windows XP isn't very reasonable, given the many advances available. I'll try this on a

Re: Image enhance

2025-09-03 Thread AM CR via Python-list
Good morning everyone. First of all, thank you in advance for your advice and suggestions. After a few attempts, I've come to the conclusion that working on Windows XP isn't very reasonable, given the many advances available. I'll try this on a Windows 7 Home machine. I'd appreciate it if someo

Re: Error installing matplotlib

2025-09-03 Thread Left Right via Python-list
It's never a good idea to run pip install without --only-binary. This should be the default that you never change. The current default is a security hazard as well as leads you to the situation you are in with no good way of debugging the problem. What you could try doing: download the wheel you a

Re: Error installing matplotlib

2025-09-03 Thread Oscar Benjamin via Python-list
On Wed, 3 Sep 2025, 15:40 Rob Cliffe, wrote: > > > On 03/09/2025 15:35, Oscar Benjamin wrote: > > > > On Wed, 3 Sep 2025, 15:21 Rob Cliffe via Python-list, < > [email protected]> wrote: > >> >> >> On 03/09/2025 14:59, Mats Wichmann wrote: >> > On 9/3/25 07:20, Rob Cliffe wrote: >> >> >> >> >

Re: Error installing matplotlib

2025-09-03 Thread Rob Cliffe via Python-list
On 03/09/2025 15:35, Oscar Benjamin wrote: On Wed, 3 Sep 2025, 15:21 Rob Cliffe via Python-list, wrote: On 03/09/2025 14:59, Mats Wichmann wrote: > On 9/3/25 07:20, Rob Cliffe wrote: >> >> >> On 03/09/2025 00:01, Mats Wichmann wrote: >>> On 9/2/25 14:51, Rob Clif

Re: Error installing matplotlib

2025-09-03 Thread Oscar Benjamin via Python-list
On Wed, 3 Sep 2025, 15:21 Rob Cliffe via Python-list, < [email protected]> wrote: > > > On 03/09/2025 14:59, Mats Wichmann wrote: > > On 9/3/25 07:20, Rob Cliffe wrote: > >> > >> > >> On 03/09/2025 00:01, Mats Wichmann wrote: > >>> On 9/2/25 14:51, Rob Cliffe via Python-list wrote: > > > > >

Re: Error installing matplotlib

2025-09-03 Thread Rob Cliffe via Python-list
On 03/09/2025 14:59, Mats Wichmann wrote: On 9/3/25 07:20, Rob Cliffe wrote: On 03/09/2025 00:01, Mats Wichmann wrote: On 9/2/25 14:51, Rob Cliffe via Python-list wrote: There are two roots here: (1) it's not finding a prebuilt wheel.  You can see that because it's proposing to use the

Re: Error installing matplotlib

2025-09-03 Thread Mats Wichmann
On 9/3/25 07:20, Rob Cliffe wrote: On 03/09/2025 00:01, Mats Wichmann wrote: On 9/2/25 14:51, Rob Cliffe via Python-list wrote: There are two roots here: (1) it's not finding a prebuilt wheel.  You can see that because it's proposing to use the source distribution instead: > Collecting

Re: Error installing matplotlib

2025-09-03 Thread Rob Cliffe via Python-list
On 03/09/2025 00:01, Mats Wichmann wrote: On 9/2/25 14:51, Rob Cliffe via Python-list wrote: There are two roots here: (1) it's not finding a prebuilt wheel.  You can see that because it's proposing to use the source distribution instead: > Collecting matplotlib >    Using cached matplot

Re: Error installing matplotlib

2025-09-03 Thread Mats Wichmann
On 9/2/25 14:51, Rob Cliffe via Python-list wrote: Hello, can anyone help?  All assistance gratefully received.  I am running python 3.13.3 on a Windows 11 machine and trying to do     pip install matplotlib (No, I don't need to say "python -m ...", I am running the right version of python.exe

Re: Image enhance

2025-09-03 Thread Joel Goldstick via Python-list
On Tue, Sep 2, 2025 at 1:46 PM amrodi--- via Python-list wrote: > > I'm new to Python. > Operating System - Windows XP SP3 > Python 2.7 installed. > > I got a script that tries to improve the image? > I created a bat file using the command line. > > C:\python27\python.exe d:\temp\teste.py > >

Re: Image enhance

2025-09-02 Thread Thomas Passin
On 9/2/2025 11:29 AM, amrodi--- via Python-list wrote: I'm new to Python. Operating System - Windows XP SP3 Python 2.7 installed. I got a script that tries to improve the image? I created a bat file using the command line. C:\python27\python.exe d:\temp\teste.py But even though it runs, it

Re: Access to return / exception context in finally block

2025-09-02 Thread marius.spix--- via Python-list
>def f(x): > try: > quot = 10 / x > except ZeroDivisionError as exc: > log_error(exc) > return 0 > else: > log_return(quot) > return quot + 1 > finally: > "Any cleanup processing needed before returning" This involves defining the new

Re: Image enhance

2025-09-02 Thread amrodi9999--- via Python-list
My code from PIL import Image, ImageEnhance import matplotlib.pyplot as plt import numpy as np import cv2 # Original image path image_path = "D:\temp\STC.jpg" # Altere se estiver em outro local original_image = Image.open(image_path) # Convert to OpenCV to apply enhancements cv_image = cv2.cvtC

Re: Access to return / exception context in finally block

2025-09-01 Thread Rob Cliffe via Python-list
On 01/09/2025 14:26, marius.spix--- via Python-list wrote: In your example when would isinstance(__exit_context__, ReturnContext) be True and when would it be False? What would __exit_context__.value be? I can't think of a sensible meaning for it. If no exception occurs, is the value returned

Re: Access to return / exception context in finally block

2025-09-01 Thread Rob Cliffe via Python-list
On 01/09/2025 14:26, marius.spix--- via Python-list wrote: In your example when would isinstance(__exit_context__, ReturnContext) be True and when would it be False? What would __exit_context__.value be? I can't think of a sensible meaning for it. If no exception occurs, is the value returned b

Re: Access to return / exception context in finally block

2025-09-01 Thread marius.spix--- via Python-list
>In your example when would isinstance(__exit_context__, ReturnContext) >be True and when would it be False? What would __exit_context__.value >be? I can't think of a sensible meaning for it. If no exception occurs, >is the value returned by f supposed to be 10/x or __exit_context__.value >+ 1

Re: Python documentary

2025-09-01 Thread Schimon Jehudah via Python-list
Good afternoon. It was a nice listening. Thank you for sharing this movie. I think, that it would be beneficial to have this distributed over P2P networks such as BitTorrent, eD2k, Gnutella, IPFS, et cetera. Speaking of which, I suppose that those mentioned organizations funded this production i

Re: Access to return / exception context in finally block

2025-09-01 Thread Left Right via Python-list
Well, this is the classic example of reinventing Lisp. But why do it incrementally and in this ridiculously inconvenient way? For those unaware of the history: https://gigamonkeys.com/book/beyond-exception-handling-conditions-and-restarts this is an informal explanation of the mechanism. Better ye

Re: Access to return / exception context in finally block

2025-08-31 Thread Rob Cliffe via Python-list
On 30/08/2025 12:03, marius.spix--- via Python-list wrote: Dear mailing list, there is currently no direct way to observe the current interpreter state in a finally block without tracing. My idea is introducing an immutable __exit_context__ magic variable, which would have one of three poss

Re: Python documentary

2025-08-30 Thread Left Right via Python-list
> Had this 'live-test' failed, where would Python be today? I'm not sure if this is irony or do you honestly believe it succeeded... but I think that "where Python is today" is pretty indicative of failure. To me, however, the failure started with the whole Python 3.X project, Guido being forced i

Re: Python documentary

2025-08-29 Thread Tim Williams via Python-list
On Fri, Aug 29, 2025 at 3:37 PM Larry Martell via Python-list < [email protected]> wrote: > https://www.youtube.com/watch?v=GfH4QL4VqJ0 > > Watched this last night. Overall I enjoyed it (but my wife, who is not a > programmer, fell asleep). My only quibble is that they spent too much time > t

Re: Python documentary

2025-08-29 Thread dn via Python-list
hange to the Python language, but back-then was an important period in the history of the Python Community deserving coverage in the movie. PPS no wish to re-ignite debate over the 'walrus operator' ("assignment expression", ie `a := 6`) Web.Refs: https://docs.python.org/3/

Re: can you improve this text-only beginner copy program?

2025-08-28 Thread dn via Python-list
The suggestion (below) is good-practice. However, it's advanced-Python compared to the OP's first-course progress. What is disappointing, is that instead of general strings as file-names the class has not been introduced to pathlib (https://docs.python.org/3/library/pathlib.html). PS Ethan:

Re: can you improve this text-only beginner copy program?

2025-08-28 Thread dn via Python-list
On 29/08/25 10:52, Grant Edwards via Python-list wrote: On 2025-08-28, Mark Bourne wrote: Ethan Carter wrote: PS. Is it just me or there's just us in this used-to-be-very-active group? Thanks for being my teacher here. Have a good day! Until a few months ago, there was a gateway that for

Re: can you improve this text-only beginner copy program?

2025-08-28 Thread Grant Edwards via Python-list
On 2025-08-28, Mark Bourne wrote: > Ethan Carter wrote: >> PS. Is it just me or there's just us in this used-to-be-very-active >> group? Thanks for being my teacher here. Have a good day! >> > > Until a few months ago, there was a gateway that forwarded messages both > ways between this newsg

Re: can you improve this text-only beginner copy program?

2025-08-28 Thread Mark Bourne
Stefan Ram wrote: Ethan Carter wrote or quoted: def copy(s, d): """Copies text file named S to text file named D.""" with open(s) as src: with open(d, "w") as dst: try: dst.write(src.read()) except Exception: os.remove(d) raise In Python there ar

Re: can you improve this text-only beginner copy program?

2025-08-28 Thread Mark Bourne
Ethan Carter wrote: PS. Is it just me or there's just us in this used-to-be-very-active group? Thanks for being my teacher here. Have a good day! Until a few months ago, there was a gateway that forwarded messages both ways between this newsgroup and a mailing list. It seems to have stop

Re: can you improve this text-only beginner copy program?

2025-08-28 Thread Grant Edwards via Python-list
On 2025-08-28, Roel Schroeven wrote: >> If an OS did let you delete an open file, how would you expect it to >> behave? Would you still be able to use the file? Would the file be >> marked for deletion and be deleted when it was finally closed? > Unix-like operating systems do let you delete a

Re: can you improve this text-only beginner copy program?

2025-08-28 Thread Roel Schroeven
Op 28/08/2025 om 18:02 schreef MRAB: On 2025-08-28 03:08, Grant Edwards via Python-list wrote: In the event of an exception, you attempt to remove the destination file BEFORE exiting the `with` statement. While that might succeed on some platforms, it will potentially fail on others. Specifica

Re: can you improve this text-only beginner copy program?

2025-08-28 Thread MRAB
On 2025-08-28 03:08, Grant Edwards via Python-list wrote: On 2025-08-27, Chris Angelico via Python-list wrote: On Thu, 28 Aug 2025 at 01:28, Ethan Carter wrote: def copy(s, d): """Copies text file named S to text file named D.""" with open(s) as src: with open(d, "w") as dst: tr

Re: can you improve this text-only beginner copy program?

2025-08-27 Thread Thomas Passin
On 8/27/2025 1:45 PM, Stefan Ram wrote: Ethan Carter wrote or quoted: You're right. There's no written statement. The exercise was suggested by the teacher while in class. It was something like ``write a program that copies text files by getting source and destination via the command-line.''

Re: can you improve this text-only beginner copy program?

2025-08-27 Thread Grant Edwards via Python-list
On 2025-08-27, Chris Angelico via Python-list wrote: > On Thu, 28 Aug 2025 at 01:28, Ethan Carter wrote: >> def copy(s, d): >> """Copies text file named S to text file named D.""" >> with open(s) as src: >> with open(d, "w") as dst: >> try: >> dst.write(src.read()) >>

Re: can you improve this text-only beginner copy program?

2025-08-27 Thread Ethan Carter
[email protected] (Stefan Ram) writes: > Ethan Carter wrote or quoted: >>Can you think of anything I'm missing? > > The correctness of a program as a solution to an assignment > depends on the exact wording of the assignment, so it's a > bit difficult to say without seeing it. You'r

Re: can you improve this text-only beginner copy program?

2025-08-27 Thread Piergiorgio Sartor
On 27/08/2025 18.57, Ethan Carter wrote: [...] """Copies text file named S to text file named D.""" This is not entirely clear, since case is significant in Python ("S" is not the same as "s"), and it is ambiguous whether it refers to a file actually named "S" or to a file whose name

Re: can you improve this text-only beginner copy program?

2025-08-27 Thread Mats Wichmann
On 8/27/25 08:03, Ethan Carter wrote: The program below only copies text files on purpose---because we haven't learned about binary files in this course yet. So just an observation on this topic (to squirrel away for future reference): if you never look at contents of the data at all, and it'

Re: can you improve this text-only beginner copy program?

2025-08-27 Thread Chris Angelico via Python-list
On Thu, 28 Aug 2025 at 01:28, Ethan Carter wrote: > def copy(s, d): > """Copies text file named S to text file named D.""" > with open(s) as src: > with open(d, "w") as dst: > try: > dst.write(src.read()) > except Exception: > os.remove(d) > raise > In

Re: not understanding the result of functools.reduce

2025-08-22 Thread Ethan Carter
[email protected] (Stefan Ram) writes: > Ethan Carter wrote or quoted: >>## The question is how to write such an operator. I wrote this one: >>def op(x, b): >> return isinstance(x, int) or b > > The main snag with your op function and how you're using > reduce is the switch-up in the

Re: Searching for a file

2025-08-10 Thread Peter J. Holzer
On 2025-08-05 22:11:57 -0400, Grant Edwards via Python-list wrote: > On 2025-08-05, Michael Torrie via Python-list wrote: > > On 5/24/25 7:19 PM, Chris Angelico via Python-list wrote: > >> for dir in dirs: > >> try: open(dir + "/" + fn).close() > >> except FileNotFoundError: pass > >>

Re: Searching for a file

2025-08-10 Thread Peter J. Holzer
On 2025-08-04 19:22:23 -0600, Michael Torrie via Python-list wrote: > On 5/24/25 7:19 PM, Chris Angelico via Python-list wrote: > > for dir in dirs: > > try: open(dir + "/" + fn).close() > > except FileNotFoundError: pass > > else: break > > > > Is this really all that difficult? Not e

Re: Searching for a file

2025-08-05 Thread Grant Edwards via Python-list
On 2025-08-05, Michael Torrie via Python-list wrote: > On 5/24/25 7:19 PM, Chris Angelico via Python-list wrote: >> On Sun, 25 May 2025 at 10:05, Rob Cliffe via Python-list >> wrote: >>> Yes, but if I understand correctly, they all start from a single >>> directory (and work downwards if required

Re: Searching for a file

2025-08-04 Thread Michael Torrie via Python-list
On 5/24/25 7:19 PM, Chris Angelico via Python-list wrote: > On Sun, 25 May 2025 at 10:05, Rob Cliffe via Python-list > wrote: >> Yes, but if I understand correctly, they all start from a single >> directory (and work downwards if required). >> My suggestion involved searching a *list* (possibly mu

RE: configparser get non-existent boolean

2025-07-01 Thread Anders Munch
Rob Cliffe wrote: > I was surprised to find that in configparser, getboolean() does not raise > KeyError for a non-existent config parameter. > Is there a good reason for this? History and backwards compatibility. The configparser module has some years on it. The rationale for this sort of thi

Re: Assignment of global variables in a script.

2025-06-30 Thread Thomas Passin
On 6/30/2025 11:53 PM, Popov, Dmitry Yu via Python-list wrote: Dear Sirs. I found the following sentence in the Python documentation: "The statements executed by the top-level invocation of the interpreter, either read from a script file or interactively, are considered part of a module called

Re: What does stats = await asyncio.to_thread(os.stat, url) do? (Was async I/O via threads is extremly slow)

2025-06-25 Thread Peter J. Holzer
On 2025-06-24 00:32:26 +0200, Mild Shock wrote: > So what does: > > stats = await asyncio.to_thread(os.stat, url) > > Whell it calls in a sparate new secondary thread: > > os.stat(url) > > It happends that url is only a file path, and > the file path points to an existing file. So the > seconda

Re: What does stats = await asyncio.to_thread(os.stat, url) do? (Was async I/O via threads is extremly slow)

2025-06-24 Thread Peter J. Holzer
On 2025-06-24 00:32:26 +0200, Mild Shock wrote: > So what does: > > stats = await asyncio.to_thread(os.stat, url) > > Whell it calls in a sparate new secondary thread: > > os.stat(url) > > It happends that url is only a file path, and > the file path points to an existing file. So the > seconda

Re: What does stats = await asyncio.to_thread(os.stat, url) do? (Was async I/O via threads is extremly slow)

2025-06-23 Thread Inada Naoki via Python-list
Other languages uses thread pool, instead of creating new thread. In Python,loop.run_in_executor uses thread pool. https://docs.python.org/3.13/library/asyncio-eventloop.html#asyncio.loop.run_in_executor 2025年6月24日(火) 8:12 Mild Shock : > > So what does: > > stats = await asyncio.to_thread(os.sta

Re: async I/O via threads is extremly slow (Was: Does Python Need Virtual Threads?)

2025-06-23 Thread Left Right via Python-list
I honestly have no idea what's being measured, but here are some numbers to compare this to, and then some explanation about async I/O in general. 1. No I/O to a local disk on a modern controller should take milliseconds. The time you are aiming for is below millisecond. That is, writing a block t

Re: PEP Idea: Extended import syntax for aliasing module attributes

2025-06-18 Thread Omar Ahmed via Python-list
The solution was provided in this thread here: https://discuss.python.org/t/extended-import-syntax-for-aliasing-module-attributes/95920/3 The correct way to implement is: import module from module import optimize, validate as check -- https://mail.python.org/mailman3//lists/python-list.python.org

Re: PEP Idea: Extended import syntax for aliasing module attributes

2025-06-18 Thread Omar Ahmed via Python-list
Thank you. I have used this link. I had difficulty finding it. https://discuss.python.org/ -- https://mail.python.org/mailman3//lists/python-list.python.org

Re: PEP Idea: Extended import syntax for aliasing module attributes

2025-06-18 Thread Omar Ahmed via Python-list
Thank you. I have posted this idea on https://discuss.python.org/c/ideas/6 I had difficulty trying to find that. -- https://mail.python.org/mailman3//lists/python-list.python.org

  1   2   3   4   5   6   7   8   9   10   >