[Python-ideas] Allow `return yield from`

2022-03-28 Thread Patrick Reader
(I originally wrote this in bpo47147, but apparently because it has to go through python-ideas first?) I would like to be able to use a `yield from` expression in a `return` statement without parentheses, as a small quality of life tweak, i.e.: return yield from gen instead of return (yield

[Python-ideas] Add __match_args__ to complex and slice

2022-03-28 Thread Patrick Reader
I'd like to be able to deconstruct `complex` objects into their real and imaginary components using a `match` statement, like:     match 1-4j:     case complex(a, b):     print(f"{a=} {b=}") This would just require setting     complex.__match_args__ = ("real", "imag") The other bu

[Python-ideas] Re: Allow `return yield from`

2022-03-28 Thread Patrick Reader
On 29/03/2022 03:18, Michael Smith wrote: On Mon, Mar 28, 2022 at 16:06 Patrick Reader wrote: I would like to be able to use a `yield from` expression in a `return` statement without parentheses, as a small quality of life tweak, i.e.: return yield from gen instead of