I've now encountered an issue I believe that PEP 533 was intended to
address:
When an asynchronous context manager is created within an asynchronous
generator, if the generator is not iterated fully, the context manager
will not exit until the event loop cancels the task by raising
a CancelledErro
d that changing the default
> behavior of for loops would break too much code.
>
> I wonder if the new PEG parser would allow us to decorate for loops
> with context sensitive keywords to override this default behavior
> without requiring code restructuring (adding a with statement).
>
Reading through the PEP again and some of the discussion, I think I now
better understand the issue.
If we were to undertake a change in for's behavior, unless the
generator is actually explicitly scoped to the for statement (and
doesn't survive outside of the loop, which is not how it works today
I've created a helper class in my own library that enhances the
existing dataclass:
a) __init__ accepts keyword-only arguments,
b) Optional[...] attribute without a specified default value would
default to None in __init__.
I think this could be useful in stdlib. I'm thinking a dataclass
decorato
The main benefits of this proposal:
- the order of fields (those with defaults, those without) is
irrelevant
- don't need to pedantically add default = None for Optional values
On Sun, 2021-01-24 at 19:46 +0000, Paul Bryan via Python-ideas wrote:
> I've created a helper class in m
Eric
> On 1/24/2021 3:07 PM, Paul Bryan via Python-ideas wrote:
>
> The main benefits of this proposal:
>
> - the order of fields (those with defaults, those without) is
> irrelevant
> - don't need to pedantically add default = None for Optional values
>
&