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

kw_only=True in class cannot be overridden by attributes #481

Open
euresti opened this issue Dec 27, 2018 · 5 comments
Open

kw_only=True in class cannot be overridden by attributes #481

euresti opened this issue Dec 27, 2018 · 5 comments
Labels

Comments

@euresti
Copy link
Contributor

euresti commented Dec 27, 2018

Mostly wondering if this is expected/desired:

import attr
@attr.s(kw_only=True)
class A:
    a = attr.ib(kw_only=False)

A(1)  # Error
@hynek
Copy link
Member

hynek commented Dec 28, 2018

That’s a good question. It’s inconsistent with other settings where attribute settings always take precedence over class settings. Kw_only is kind of special but probably not special enough to break that contract? 🤔

@euresti
Copy link
Contributor Author

euresti commented Dec 29, 2018

Let me know if this changes because I'll have to update the mypy plugin. (Currently it's written with the current behavior)

@huzecong
Copy link

Just wondering if there's still planned support for overriding the class kw_only=True setting in attributes? I don't think this is supported as of v21.2.0.

@hynek
Copy link
Member

hynek commented Oct 23, 2021

“Planned” is a strong word, but a good PR has good chances to get merged.

@chrysle
Copy link
Contributor

chrysle commented Apr 6, 2023

I think I'll do some brain-storming on this.

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

No branches or pull requests

5 participants