Steven D'Aprano wrote:
(In hindsight, it was probably a mistake for Python to define two create-
an-object methods, although I expect it was deemed necessary for
historical reasons.
I'm not sure that all of the reasons are historical. Languages
that have a single creation/initialisation method also usually
have a mechanism for automatically calling a base version
of the method if you don't do that explicitly, and they
typically do it by statically analysing the source. That's
not so easy in a dynamic language.
If Python only had __new__, everyone who overrode it would
have to start with an explicit call to the base class's
__new__, adding a lot of boilerplate and forcing people
to learn how to make base method calls much sooner than
they would otherwise need to.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list