Skip to content

Conversation

@alanhdu
Copy link

@alanhdu alanhdu commented Mar 25, 2018

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

@alanhdu
Copy link
Author

alanhdu commented Mar 25, 2018

So I guess there are two things to discuss:

(1) How does this work with inheritance? In this PR, I chose to take the simplest route and say that if C is a kwarg-only dataclass, then all of its sub and super dataclasses must also be kwarg-only (similar to how frozen works)

(2) What to call the flag? I choose kwarg_only, although I could see kwargs_only, keyword_only, kw_only, etc. I've got no real preference here 😆.

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

@ericvsmith
Copy link
Member

We'll need to discuss this on python-ideas first. But since 3.8 is 1.5+ years away, I don't think we'll take any actions on it until dataclasses have some real-world use. Maybe look at attrs or similar projects and see what they do (or if they've had any discussions on this topic) before bringing it up on the mailing list.

@brettcannon
Copy link
Member

Closing as the CLA has not been signed within the last month.

@bm371613
Copy link

@brettcannon How can this be pushed forward? The author apparently has lost interest or didn't want to sign the CLA. If I want this feature to be added, do I need to try to unsee the code changes here and implement the exact same thing myself, hoping it's not too similar?

@ericvsmith
Copy link
Member

I'm not sure it makes sense to move forward until we have a firm design. There are various proposals for making all params keyword only, some params keyword only (via Field), and various options with what to do when inheriting. I think working this out on python-ideas first, then recording the decisions in the bpo issue, then writing a patch is the correct order.

I'd also like to do some research on what attrs does, if that's not already been done.

I'm not sure if this rises to the level of needing a PEP, but there are a lot of issues to work through.

@bm371613
Copy link

@ericvsmith This was proposed 3 times in 2018 on python-ideas:

https://mail.python.org/archives/list/python-ideas@python.org/message/YOK5DRIPJJ4TXIVI2F7VYJZ3LBE35DCG/
https://mail.python.org/archives/list/python-ideas@python.org/message/EGP6V2CCFUMNSSPJ7FP7N57VBWYTRZE4/
https://mail.python.org/archives/list/python-ideas@python.org/message/6V55RQNH5NIBKS4BR7HXP7M42EISQWZH/

and it stopped at "OK, but we need to discuss the details and it won't be the upcoming release anyway".

I have recently tried to revive the discussion on python-ideas, so far only receiving one reply with support, but I don't think that was from a core developer.

attrs have kw_only both on class and field level https://www.attrs.org/en/stable/examples.html#keyword-only-attributes

I'm not saying this needs to be translated from attrs 1-to-1, but

  • there seems to be demand for this
  • there were no objections
  • attrs have this and it can be directly translated

I'm worried that the set of people who care about this feature is disjoint with the set of people who can conclude that the necessary discussion has reached a conclusion. I will reply to the original thread on python-ideas once more, pointing to the attrs solution. Could you please give it some thought, and some feedback, so that after a week (?) of no objections you could conclude that the discussion has reached a conclusion?

@ChrisBarker-NOAA
Copy link
Contributor

PIng! has anything come of this? I think it'd be a great feature.

@Hyaxia
Copy link

Hyaxia commented May 10, 2020

PIng! has anything come of this? I think it'd be a great feature.

Same here, great feature to be added!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants