__init__ is the initialiser
Gregory Ewing
greg.ewing at canterbury.ac.nz
Sun Feb 2 18:38:00 EST 2014
More information about the Python-list mailing list
Sun Feb 2 18:38:00 EST 2014
- Previous message (by thread): __init__ is the initialiser
- Next message (by thread): __init__ is the initialiser
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message (by thread): __init__ is the initialiser
- Next message (by thread): __init__ is the initialiser
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list