[issue33129] Add kwarg-only option to dataclass
Change by Alan Du <ahd2...@columbia.edu>: -- keywords: +patch pull_requests: +5975 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33129> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33129] Add kwarg-only option to dataclass
Alan Du <ahd2...@columbia.edu> added the comment: Err... the right link would actually be https://github.com/alanhdu/cpython/tree/bpo-33129. -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33129> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33129] Add kwarg-only option to dataclass
Alan Du <ahd2...@columbia.edu> added the comment: If this would be accepted, I'd be happy to contribute a patch adding a `kwarg_only` option to `dataclass` (although it might take me a while since I'm not super familiar with the Python development workflow). I believe I already have the code change necessary at https://github.com/alanhdu/cpython/commit/fa35b39e5204845690ff774812f882f40b0e5f90 (although it still needs tests and documentation). -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33129> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33129] Add kwarg-only option to dataclass
New submission from Alan Du <ahd2...@columbia.edu>: I'd like to request a new option to the `dataclasses.dataclass` decorator to make the `__init__` keyword-only. The two use-cases I have in mind are: (1) Using as a dataclass big-bag-of-config. In this scenario, forcing the user to specify the keywords is a lot nicer than passing in a dozen positional parameters. (2) Having kwarg-only parameters means that inheritance and default parameters play nicely with each other again instead of raising a TypeError. -- components: Library (Lib) messages: 314341 nosy: alan_du, eric.smith priority: normal severity: normal status: open title: Add kwarg-only option to dataclass type: enhancement versions: Python 3.7, Python 3.8 ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33129> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com