[Python-ideas] `importlib.resources` access whole directories as resources

2022-05-09 Thread tankimarshal2
An `importlib.resources.as_file` equivalent but for whole directories. To access a directory of files in a package and load them (for example, a skybox with 6 faces), one would need to use `as_file` 6 times with 6 context managers. Moreover, if the API required a path to a folder that contained

[Python-ideas] Expression formed with structural pattern matching

2022-05-09 Thread Matsuoka Takuo
I've been unable to find a discussion on the following subject. I think structural pattern matching could sometimes be more useful to be available to form an expression than to form a statement. To be specific, given the definition of a function of the form ``` def f(): match : case

[Python-ideas] Re: Time to relax some restrictions on the walrus operator?

2022-05-09 Thread Matsuoka Takuo
On Mon, 9 May 2022 at 08:35, Jeremiah Vivian wrote: > > I've always thought of relaxing the restrictions. It's actually easy to > implement (even including attribute assignment/subscript assignment) and I > had to modify only two files (plus regenerate the parser). I think attribute assignment

[Python-ideas] Re: `importlib.resources` access whole directories as resources

2022-05-09 Thread Filipe LaĆ­ns
On Sun, 2022-05-08 at 17:36 +, [email protected] wrote: > An `importlib.resources.as_file` equivalent but for whole directories. > > To access a directory of files in a package and load them (for example, a > skybox with 6 faces), one would need to use `as_file` 6 times with 6 context >

[Python-ideas] Re: Time to relax some restrictions on the walrus operator?

2022-05-09 Thread Rob Cliffe via Python-ideas
On 08/05/2022 13:08, Valentin Berlier wrote: A while ago there was a discussion about allowing "match" patterns for the walrus operator. This would cover iterable unpacking as you suggested along with all the patterns allowed in match statements. if [x, y, z] := re.match(r"...").groups(