[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-28 Thread Cameron Simpson
On 28Feb2021 20:05, Guido van Rossum wrote: >I'm trying to shorten this again... > >On Sun, Feb 28, 2021 at 5:54 PM Cameron Simpson wrote: >> Let's turn this on its head: >> - what specific harm comes from giving EGs container truthiness for >> size >> testing? > >For something that's not a

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-28 Thread Guido van Rossum
I'm trying to shorten this again... On Sun, Feb 28, 2021 at 5:54 PM Cameron Simpson wrote: > > Let's turn this on its head: > > - what specific harm comes from giving EGs container truthiness for size > testing? > For something that's not a pure container, this is an anti-pattern. No other

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-28 Thread Cameron Simpson
On 28Feb2021 23:56, Irit Katriel wrote: >If you go long, I go longer :) :-) >On Sun, Feb 28, 2021 at 10:51 PM Cameron Simpson wrote: >> On 28Feb2021 10:40, Irit Katriel wrote: >> >split() and subgroup() take care to preserve the correct metadata on >> >all >> >the internal nodes, and if you

[Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-28 Thread Eryk Sun
On 2/28/21, Oscar Benjamin wrote: > > Oh, okay. So does that mean that it's always on PATH unless the user > *explicitly unticks* the "install the launcher" box for both single > user and all user installs? If the launcher gets installed, it will be available in PATH. IIRC, the installer only

[Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-28 Thread Oscar Benjamin
On Mon, 1 Mar 2021 at 00:13, Eryk Sun wrote: > > On 2/28/21, Oscar Benjamin wrote: > > > > - It is possible to configure a default version (although I think you > > have to do it with an environment variable) > > The py launcher in Windows supports a "py.ini" file beside the > executable and in

[Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-28 Thread Eryk Sun
On 2/28/21, Oscar Benjamin wrote: > > - It is possible to configure a default version (although I think you > have to do it with an environment variable) The py launcher in Windows supports a "py.ini" file beside the executable and in %LocalAppData%. The equivalent of the PY_PYTHON, PY_PYTHON2,

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-28 Thread Irit Katriel via Python-Dev
Hi Cameron, If you go long, I go longer :) On Sun, Feb 28, 2021 at 10:51 PM Cameron Simpson wrote: > On 28Feb2021 10:40, Irit Katriel wrote: > >split() and subgroup() take care to preserve the correct metadata on > >all > >the internal nodes, and if you just use them you only make safe >

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-28 Thread Marco Sulla
On Sat, 27 Feb 2021 at 00:35, Guido van Rossum wrote: > On Fri, Feb 26, 2021 at 3:18 PM Marco Sulla > wrote: >> >> Excuse me if I post here. Maybe is a stupid question: why, instead of >> introducing except*, Python can't extend the functionality of except, >> so it can do what except* would

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-28 Thread Cameron Simpson
On 27Feb2021 00:54, Irit Katriel wrote: >On Sat, Feb 27, 2021 at 12:47 AM Jim J. Jewett wrote: >> > Is this not allowed? >> >> >try: >> >try: >> >obj.func()# function that raises ExceptionGroups >> >except AttributeError: >> >logger.info("obj doesn't have a func") >>

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-28 Thread Cameron Simpson
This message is longer than I had anticipated. To aid comprehension, I'm: - accepting that .split and .subgroup help my "handle some excpetions but not others" situation, barely - arguing for ExceptionGroups acting like other containers: truthy if nonempty, falsey if empty; iterable;

[Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-28 Thread Wes Turner
Is there a tool that (1) detects import name collisions; and (2) attempts to read package metadata and package file checksums (maybe from the ZIP 'manifest')? In order to: - troubleshoot module shadowing issues - $PATH - sys.path - `python -m site` - incomplete and overlapping

[Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-28 Thread Oscar Benjamin
On Sun, 28 Feb 2021 at 07:04, Stephen J. Turnbull wrote: > > Jim J. Jewett writes: > > > > which file am I actually running? > > > which interpreter am I actually running? > > > how do I tell the computer to use a different interpreter? > > > > If you need to care about any of these, then

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-28 Thread Guido van Rossum
You can pass an arbitrary function to eg.split() and eg.subgroup(), and that function can have a side effect. Suppose you want to log and ignore OSError with errno==ENOENT but re-raise the rest, you can do this: ``` def log_and_ignore(err): if err.errno == ENOENT: log(err)

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-28 Thread Jim J. Jewett
Looking at the following PEP example, I'm still not sure what he should do to handle some but not all OSError instances: ...raise ExceptionGroup( ... "eg", ... [ ... ValueError(1), ... TypeError(2), ... OSError(3), ...

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-28 Thread Irit Katriel via Python-Dev
On Sun, Feb 28, 2021 at 6:17 PM Guido van Rossum wrote: > On Sun, Feb 28, 2021 at 2:40 AM Irit Katriel > wrote: > >> >> In earlier versions of the PEP ExceptionGroup was not immutable and split >> actually removed matching exceptions from it. >> It was also iterable so you could get a flat list

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-28 Thread Guido van Rossum
On Sun, Feb 28, 2021 at 2:40 AM Irit Katriel wrote: > > In earlier versions of the PEP ExceptionGroup was not immutable and split > actually removed matching exceptions from it. > It was also iterable so you could get a flat list of all the contained > leaf exceptions. Then we changed it. > >

[Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-28 Thread Jim J. Jewett
> And unlike a venv, "python -m" doesn't let you ensure > that the code executed is the version installed in user site-packages I have had enough problems with this that when I do modify/replace something, I put in a marker that I can check for explicitly. Expecting this marker to run

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-28 Thread Irit Katriel via Python-Dev
In earlier versions of the PEP ExceptionGroup was not immutable and split actually removed matching exceptions from it. It was also iterable so you could get a flat list of all the contained leaf exceptions. Then we changed it. ExceptionGroup is a tree of exceptions, and the internal nodes of the