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
pa@see.signature.invalid (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, < > python-list@python.org> 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, < python-list@python.org> 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 < python-list@python.org> 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
r...@zedat.fu-berlin.de (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
r...@zedat.fu-berlin.de (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

Re: Matplotlib "collections" module in recent Python, Matplotlib

2025-06-18 Thread jmhannon.ucdavis--- via Python-list
Thanks, D'Arcy. I've done a fair amount of 2-to-3 migration in the past, but there was a lot of stuff in that article ("six", for instance) that I hadn't run across. -- https://mail.python.org/mailman3//lists/python-list.python.org

Re: Matplotlib "collections" module in recent Python, Matplotlib

2025-06-18 Thread jmhannon.ucdavis--- via Python-list
Thanks. That appears to be exactly the thing I was looking for (vis-a-vis collections). -- https://mail.python.org/mailman3//lists/python-list.python.org

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

2025-06-18 Thread Abdur-Rahmaan Janhangeer via Python-list
And here: https://discuss.python.org/c/ideas/6 Kind Regards, Abdur-Rahmaan Janhangeer about | blog github Mauritius On Tue, Jun 17, 2025 at 4:20 PM Barry Scott wrote: > > > > On 17

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

2025-06-17 Thread Barry
On 17 Jun 2025, at 15:17, Neal Becker wrote: On Tue, Jun 17, 2025 at 8:19 AM Barry Scott <[1]ba...@barrys-emacs.org> wrote: > On 17 Jun 2025, at 00:19, Omar Ahmed via Python-list <[2]python-list@python.org> wrote: > > Hi all, > I would like to propose a potent

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

2025-06-17 Thread Neal Becker via Python-list
On Tue, Jun 17, 2025 at 8:19 AM Barry Scott wrote: > > > > On 17 Jun 2025, at 00:19, Omar Ahmed via Python-list < > python-list@python.org> wrote: > > > > Hi all, > > I would like to propose a potential addition to Python's `import` syntax > that would improve clarity and ergonomics for cases whe

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

2025-06-17 Thread Barry Scott
> On 17 Jun 2025, at 00:19, Omar Ahmed via Python-list > wrote: > > Hi all, > I would like to propose a potential addition to Python's `import` syntax that > would improve clarity and ergonomics for cases where developers want both > full module access *and* a local alias to a specific attr

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

2025-06-16 Thread Rob Cliffe via Python-list
On 17/06/2025 00:19, Omar Ahmed via Python-list wrote: Hi all, I would like to propose a potential addition to Python's `import` syntax that would improve clarity and ergonomics for cases where developers want both full module access *and* a local alias to a specific attribute within that mod

Re: Matplotlib "collections" module in recent Python, Matplotlib

2025-06-16 Thread D'Arcy Cain
On 6/14/25 23:53, jmhannon.ucdavis--- via Python-list wrote: Greetings. We (the group that I work with) have "inherited" some Python scripts that were written years ago, using Python 2. We're trying to upgrade the scripts so that they work in our current environment: https://www.scoutapm.com/

Re: Matplotlib "collections" module in recent Python, Matplotlib

2025-06-16 Thread MRAB
On 2025-06-15 04:53, jmhannon.ucdavis--- via Python-list wrote: Greetings. We (the group that I work with) have "inherited" some Python scripts that were written years ago, using Python 2. We're trying to upgrade the scripts so that they work in our current environment: OS: Ubuntu 24.04.2

Re: Does Python Need Virtual Threads? (Posting On Python-List Prohibited)

2025-06-14 Thread Mild Shock
Concerning virtual threads the only problem with Java I have is, that JDK 17 doesn't have them. And some linux distributions are stuck with JDK 17. Otherwise its not an idea that belongs solely to Java, I think golang pioniered them with their goroutines. I am planning to use them more heavily

Re: Seeing Variables

2025-06-12 Thread Mats Wichmann
On 6/12/25 02:59, Stefan Ram wrote: r...@zedat.fu-berlin.de (Stefan Ram) wrote or quoted: But how to achieve the same for local variables? import pdb def f(): a = 1 pdb.set_trace() f() . Now, the program stops there and you can enter: print( a )(user input) 1 (

Re: Tkinter: repeated calls to Text.window_create() gradually slow down

2025-06-10 Thread MRAB
event increasing memory use, the widgets inside the windows are "recycled", i.e. hidden using a tag and cached when the window is closed, to be re-used when needed. New widgets are only created when the cache is empty. The code below demonstrates the issue by rapidly creating and hiding a window

Re: magic-wormhole 0.19.0

2025-06-01 Thread MyMilestone Card via Python-list
Thanks for sharing the update, Meejah! Great to see the addition of the status feedback API and improved Dilation handling, those changes should definitely enhance usability and performance. Also appreciate the move to pytest and the clearer packaging per PEP 625. Solid work! -- https://mail.py

Re: magic-wormhole 0.19.2

2025-05-30 Thread meejah
There were a couple of minor problems with 0.19.0 and so I have yanked 0.19.0 and 0.19.1 -- everyone should use 0.19.2. The main issue (and reason for pulling those versions) is that although the release notes say words about requiring Python 3.10, the metadata didn't say that. The metadata is

Re: Python tutor mailing list?

2025-05-28 Thread Marc Nicole via Python-list
Being a user of that list i've also noticed that only recently. hope that this list is good enough to take on all python questions. Are there any other alternative lists? Thx On Wed, 28 May 2025, 01:35 Alan Gauld via Python-list, < python-list@python.org> wrote: > I am the moderator of the python

Re: Searching for a file

2025-05-28 Thread Mats Wichmann
On 5/28/25 03:29, Peter J. Holzer wrote: On 2025-05-28 10:59:16 +0300, Roland Mueller via Python-list wrote: ke 28.5.2025 klo 1.45 Thomas Passin (li...@tompassin.net) kirjoitti: On 5/27/2025 10:41 AM, Roland Mueller via Python-list wrote: To get a list of files in a given directory one can use

Re: Python tutor mailing list?

2025-05-28 Thread Mats Wichmann
On 5/27/25 18:00, Alan Gauld via Python-list wrote: On 28/05/2025 00:32, Alan Gauld via Python-list wrote: The archives are still there and the sign-up page seems to work, but it doesn't recognise me. I tried signing up as a new member with a different address and that seems to work(ie no error

Re: Searching for a file

2025-05-28 Thread Peter J. Holzer
On 2025-05-28 10:59:16 +0300, Roland Mueller via Python-list wrote: > ke 28.5.2025 klo 1.45 Thomas Passin (li...@tompassin.net) kirjoitti: > > On 5/27/2025 10:41 AM, Roland Mueller via Python-list wrote: > > > To get a list of files in a given directory one can use glob.glob and > > > > The OP had

Re: Searching for a file

2025-05-28 Thread Roland Mueller via Python-list
ke 28.5.2025 klo 1.45 Thomas Passin (li...@tompassin.net) kirjoitti: > On 5/27/2025 10:41 AM, Roland Mueller via Python-list wrote: > > To get a list of files in a given directory one can use glob.glob and > > The OP had a different problem. He wanted to find a config file of > known name that co

Re: Python tutor mailing list?

2025-05-27 Thread dn via Python-list
Message received! Hope you enjoyed your holiday... On 28/05/25 12:00, Alan Gauld via Python-list wrote: On 28/05/2025 00:32, Alan Gauld via Python-list wrote: The archives are still there and the sign-up page seems to work, but it doesn't recognise me. I tried signing up as a new member with

Re: Python tutor mailing list?

2025-05-27 Thread Alan Gauld via Python-list
On 28/05/2025 00:32, Alan Gauld via Python-list wrote: > The archives are still there and the sign-up page seems to > work, but it doesn't recognise me. I tried signing up as > a new member with a different address and that seems to work(ie no > errors) but I still don;t see any list activity. I

Re: Searching for a file

2025-05-27 Thread Thomas Passin
On 5/27/2025 10:41 AM, Roland Mueller via Python-list wrote: To get a list of files in a given directory one can use glob.glob and The OP had a different problem. He wanted to find a config file of known name that could be in one of several locations. os.path.isfile from os.path import i

Re: Searching for a file

2025-05-27 Thread Peter J. Holzer
On 2025-05-24 17:18:11 -0600, Mats Wichmann wrote: > On 5/23/25 16:05, Rob Cliffe via Python-list wrote: > > On 23/05/2025 18:55, Mats Wichmann wrote: > > > On 5/22/25 21:04, Rob Cliffe via Python-list wrote: > > > > It occurs to me that it might be useful if Python provided a > > > > function to s

Re: Searching for a file

2025-05-27 Thread Roland Mueller via Python-list
When answering I saw only the post from Peter. Everything else was in SPAM folder. GMail was so kind to move the "junk" mails to my Inbox after pressing SENT :-) My code works in Linux but with a small change it should work in Windows too. ti 27.5.2025 klo 17.41 Roland Mueller (roland.em0...@goog

Re: Searching for a file

2025-05-27 Thread Roland Mueller via Python-list
To get a list of files in a given directory one can use glob.glob and os.path.isfile >>> from os.path import isfile >>> from glob import glob >>> files_in_var_tmp = [f for f in glob('/var/tmp/*') if isfile(f) ] For several directories iterate over the dirs and add the resulting list of files. >>

Re: Searching for a file

2025-05-24 Thread Chris Angelico via Python-list
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 multiple lists) of > directories. for dir in dirs: try: open(d

Re: Searching for a file

2025-05-24 Thread Rob Cliffe via Python-list
On 25/05/2025 00:18, Mats Wichmann wrote: On 5/23/25 16:05, Rob Cliffe via Python-list wrote: On 23/05/2025 18:55, Mats Wichmann wrote: On 5/22/25 21:04, Rob Cliffe via Python-list wrote: It occurs to me that it might be useful if Python provided a function to search for a file with a give

Re: Searching for a file

2025-05-24 Thread Mats Wichmann
On 5/23/25 16:05, Rob Cliffe via Python-list wrote: On 23/05/2025 18:55, Mats Wichmann wrote: On 5/22/25 21:04, Rob Cliffe via Python-list wrote: It occurs to me that it might be useful if Python provided a function to search for a file with a given name in various directories (much as the i

Re: Best practice for config files?

2025-05-24 Thread Michael F. Stemper via Python-list
On 22/05/2025 15.27, Stefan Ram wrote: "Michael F. Stemper" wrote or quoted: Should I specify the location of the config file with a command-line option, or is requiring the program to be executed in the directory containing the configuration file considered acceptable practice? It was me

Re: Best practice for config files?

2025-05-24 Thread Mats Wichmann
On 5/23/25 07:35, Chuck Rhode wrote: On Thu, 22 May 2025 14:59:28 -0500 "Michael F. Stemper" wrote: Is requiring the program to be executed in the directory containing the configuration file considered acceptable practice? Freedesktop.org proposes a specification for where such things ought

Re: Best practice for config files?

2025-05-24 Thread Jason H via Python-list
On 22/05/2025 20:59, Michael F. Stemper wrote: I recently wrote a program to do some record-keeping for me. I found myself hard-coding a bunch of different values into it. This didn't seem right, so I made my first use of configparser.ConfigParser(). Created the configuration file and everything

Re: Best practice for config files? (Posting On Python-List Prohibited)

2025-05-23 Thread rbowman
On Fri, 23 May 2025 22:22:36 - (UTC), Lawrence D'Oliveiro wrote: > On 23 May 2025 19:18:23 GMT, Stefan Ram wrote: > >> Coincidentally, I just read: >> >> |When IDLE first starts, it attempts to read user |configuration files >> in ~/.idlerc/ (~ is one's home |directory). > > Apps should be

Re: Best practice for config files?

2025-05-23 Thread Chuck Rhode
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thu, 22 May 2025 14:59:28 -0500 "Michael F. Stemper" wrote: > Is requiring the program to be executed in the directory containing > the configuration file considered acceptable practice? Freedesktop.org proposes a specification for where such thi

Re: Searching for a file

2025-05-23 Thread Rob Cliffe via Python-list
On 23/05/2025 18:55, Mats Wichmann wrote: On 5/22/25 21:04, Rob Cliffe via Python-list wrote: It occurs to me that it might be useful if Python provided a function to search for a file with a given name in various directories (much as the import.import_lib function searches for a module in th

Re: Searching for a file

2025-05-23 Thread Mats Wichmann
On 5/22/25 21:04, Rob Cliffe via Python-list wrote: It occurs to me that it might be useful if Python provided a function to search for a file with a given name in various directories (much as the import.import_lib function searches for a module in the directories in sys.path). This function w

Re: Best practice for config files?

2025-05-23 Thread c . buhtz
Hello Michael, thank you for your important question. On GNU/Linux (and maybe for POSIX?) systems there is a standard about it. Look for $XDG_CONFIG_HOME. To drive it further, you might distinguish between config data (related and

Re: Best practice for config files?

2025-05-22 Thread Grant Edwards via Python-list
On 2025-05-23, Thomas Passin wrote: >> Alternatively look at the PATH envronment variable, which >> contains a list of directories separated by semicolons and which you can >> access as os.environ['PATH'] . > > There is really no reason for a config file to be on the system > path. On Unix/Lin

  1   2   3   4   5   6   7   8   9   10   >