[issue33129] Add kwarg-only option to dataclass

2021-03-17 Thread Eric V. Smith
Eric V. Smith added the comment: Closing this in favor of issue 43532, which has a slightly elaborated approach. -- resolution: -> duplicate stage: patch review -> resolved status: open -> closed superseder: -> Add keyword-only fields to dataclasses

[issue33129] Add kwarg-only option to dataclass

2021-01-25 Thread Paul Bryan
Change by Paul Bryan : -- nosy: +pbryan ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue33129] Add kwarg-only option to dataclass

2020-12-16 Thread conchylicultor
conchylicultor added the comment: For the API, I think we could add this feature with a single new `dataclass(kw_only: bool | str)` ``` @dataclasses.dataclass(kw_only=True) class A: a: int b: int c: int # A(*, a, b, c) @dataclasses.dataclass(kw_only='b') class A: a: int b: int

[issue33129] Add kwarg-only option to dataclass

2020-11-11 Thread conchylicultor
conchylicultor added the comment: Solving this would significantly improve @dataclass inheritance (https://bugs.python.org/issue39300). Any idea when this will land ? Currently, it is not possible to add required argument to a child dataclass (unless hacks like duplicating attributes): ```

[issue33129] Add kwarg-only option to dataclass

2020-10-17 Thread Ryan Hiebert
Change by Ryan Hiebert : -- nosy: +ryanhiebert ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue33129] Add kwarg-only option to dataclass

2020-08-11 Thread wyz23x2
wyz23x2 added the comment: Since '/' was introduced in Python 3.8, support for positional parameters should be supported too. -- nosy: +wyz23x2 versions: +Python 3.9 ___ Python tracker

[issue33129] Add kwarg-only option to dataclass

2020-07-22 Thread pmp-p
Change by pmp-p : -- nosy: +pmpp ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue33129] Add kwarg-only option to dataclass

2020-07-22 Thread Prakhar Goel
Prakhar Goel added the comment: Hi, As another piece of evidence: I run into this problem _all the time_. Whenever I need a field in the parent with a default, I either need to add bogus default values for every field in every subclass or just skip the default in the parent. I'd like to

[issue33129] Add kwarg-only option to dataclass

2020-03-28 Thread Michael Lee
Michael Lee added the comment: Hello! I've submitted a PR based on this issue, since it seemed the most relevant from my searching of the backlog. Here's a link: https://github.com/python/cpython/pull/19206 -- ___ Python tracker

[issue33129] Add kwarg-only option to dataclass

2020-03-28 Thread Michael Lee
Change by Michael Lee : -- nosy: +michael.lee nosy_count: 5.0 -> 6.0 pull_requests: +18569 pull_request: https://github.com/python/cpython/pull/19206 ___ Python tracker ___

[issue33129] Add kwarg-only option to dataclass

2018-07-26 Thread Jimbo Jim
Jimbo Jim added the comment: first post in bugs.python.org... are people normally scary around here? Another usecase of keyword-only arguments is that I can mix default and non-default fields in any order. This could be achieved by either marking all fields as read-only, or by implicitly

[issue33129] Add kwarg-only option to dataclass

2018-07-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: +1 from me -- think would occasionally be nice to have. -- nosy: +rhettinger ___ Python tracker ___

[issue33129] Add kwarg-only option to dataclass

2018-07-17 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: There is an open PR and some discussion about this feature in attrs repo : https://github.com/python-attrs/attrs/pull/281 -- nosy: +xtreak ___ Python tracker

[issue33129] Add kwarg-only option to dataclass

2018-05-16 Thread Eric V. Smith
Eric V. Smith added the comment: I'd forgotten about this issue and created #33493. I'll close it. Copied here is my comment from that issue: I've had several requests for keyword-only arguments. This is a placeholder to remind me to work on it. I have not decided if it's

[issue33129] Add kwarg-only option to dataclass

2018-03-25 Thread Alan Du
Change by Alan Du : -- keywords: +patch pull_requests: +5975 stage: -> patch review ___ Python tracker ___

[issue33129] Add kwarg-only option to dataclass

2018-03-23 Thread Eric V. Smith
Eric V. Smith added the comment: Changing this to 3.8: there's not enough time to add this to 3.7. -- versions: -Python 3.7 ___ Python tracker

[issue33129] Add kwarg-only option to dataclass

2018-03-23 Thread Eric V. Smith
Change by Eric V. Smith : -- assignee: -> eric.smith ___ Python tracker ___ ___

[issue33129] Add kwarg-only option to dataclass

2018-03-23 Thread Alan Du
Alan Du added the comment: Err... the right link would actually be https://github.com/alanhdu/cpython/tree/bpo-33129. -- ___ Python tracker

[issue33129] Add kwarg-only option to dataclass

2018-03-23 Thread Alan Du
Alan Du 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

[issue33129] Add kwarg-only option to dataclass

2018-03-23 Thread Alan Du
New submission from Alan Du : 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