-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Why does __init__
exist?
#239
Comments
Hello ! Thanks for reporting the issue. |
@corenting the PR that I created on your repo will resolve this issue if merged. When you have some time can you review it? |
Sorry for the late answer and thanks for the MR ! I will try to take some time to review it |
The MR was merged, thanks again. Closing the issue at will be included in the next release. |
Thanks for the merge! |
Why does
__init__
exist for this class?Should an immutable class do all setup in
__new__
and not need to invoke__init__
at all?My understanding is that yes it should.
For example tuple does not need to invoke init to return back the fully formed instance, it only needs new.
How about moving the
__init__
setup into the__new__
method and releasing a new major version with the update?Hmm doing that might require that the class inherit from tuple or namedtuple to be able to store the hash and dict with type hints.
The text was updated successfully, but these errors were encountered: