Post
by iseahound » 03 Oct 2022, 10:09
I found it to be useful to separate between a private constructor and a public user facing constructor. I first noticed that I could do this when I was writing wrapper functions to get rid of the new keyword in v1. It's not the best approach, as one could create a sub class and inherit from the main class and over writing its instance variables like in Java. Another approach would be to throw the extra arguments into **kwargs (keyword arguments/named parameters) and forget about them, if I was writing Python.
It is really interesting that __New allows parameters, even when shadowed or hidden by static call. I don't know if you designed it intentionally, or what languages have such a similar feature, but it does seem better (to me at least) to not spawn an extra class or use an extraordinary amount of named parameters which leads to annoying documentation (which params do I care about? which ones to ignore?), as in the case with Python.