Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keyword-only attrs #335

Closed
asvetlov opened this issue Jan 27, 2018 · 4 comments · Fixed by #411
Closed

keyword-only attrs #335

asvetlov opened this issue Jan 27, 2018 · 4 comments · Fixed by #411

Comments

@asvetlov
Copy link

asvetlov commented Jan 27, 2018

It would be nice to support keyword-only constructor parameters, e.g.

@attr.s
class A:
    a = attr.ib()
    b = attr.ib(keyword=True)

A(1, 2)  # forbidden
A(1, b=2)  # passed

Should be allowed for Python 3 only.
Well, attrs should have no Python 3 specific code -- compilation of __init__ function with keyword-only arguments generates SyntaxError on Python 2, maybe enough.

I don't know what name is better: keyword, kw_only, keyword_only.

@hynek
Copy link
Member

hynek commented Jan 28, 2018

Theere is a half-finished PR for this #281 but nobody came around to fix it into a mergeable shape.

@asvetlov
Copy link
Author

Looks like we are in opposite situation.
I have no time to work on the issue, the feature doesn't kick my ass yet.
You have no time for working on aiohttp and family problems for the same reason I guess.

@hynek
Copy link
Member

hynek commented Feb 28, 2018

Heh exactly. 😂 I didn’t mean it accusingly, just wanted to point out there’s some work.

@asvetlov
Copy link
Author

Anyway thank you for raising issues. We have client tracing support by aiohttp client finally for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants