On Mon, Feb 10, 2020 at 9:30 AM
It's been two years since this proposal has been postponed - I would like to revive it.
...I propose the addition of a keyword_only flag to the @dataclass decorator that renders the __init__ method using keyword only arguments:
@dataclass(keyword_only=True) class Bar(Foo): other_field: int
Guido van Rossum wrote:
We can reconsider for 3.8. --Guido van Rossum (python.org/~guido)
What do you think about implementing this now? What should be the next step? Would it require a PEP?
Just lending support to the idea: this would be a fantastic addition to the dataclasses module and I for one would use it CONSTANTLY. The style of coding I have become accustomed to relying upon (in the context of professional engineering calculations and analyses) has tended to favor kwarg-only arguments a majority of the time, for a variety of reasons. It's possible I'm creating problems for future me, but I don't think so. When using a good IDE or Jupyter, kwarg-only functions are far from a hassle to use, they are really a pleasure to use (and read).