-
Notifications
You must be signed in to change notification settings - Fork 53
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
__init__ should be kwargs-only #55
Comments
Related in |
I disagree. If I have a Point class with attributes x, y and z I'd like to be able to call |
OK, I see the cosmetic win there, but what if you started without Perhaps a means to specify the comparison order for attributes, then. The problem here is we're coupling definition order to a few things that aren't necessarily otherwise coupled to each other. |
I am with Guido here. Requiring kwargs-only by default is too radical. I could imagine an option in |
I think we don't want to support keyword-only params to |
The initializer should ideally be kwargs-only. That is:
should be:
The reason is that the automatically generated methods are all using the definition order in the class, so if, for example, I add a new attribute and I want comparison to look at it before some other attribute, I’d have to possibly change the definition order, which will change the signature of init in an incompatible way. By making the method kwargs-only, you can ensure that you aren't breaking clients when you do that.
The text was updated successfully, but these errors were encountered: