Simon King <simon.k...@uni-jena.de> writes: > Hi Kwankyu, > > On 2012-05-03, Kwankyu Lee <ekwan...@gmail.com> wrote: >>> > As the "..Algebra.__init__" is expected to be >>> > placed at the beginning of the initialization code >>> >>> Why? Is that a Python convention? >> >> >> Isn't that a convention of objected-oriented programming? > > No idea. Clearly, unless there is a good reason, the init method of the > base class should be called at some point. But I was not aware of a > convention whether the base init should be called first or last or > whatever. Does someone have a pointer?
I think the reasoning behind calling the parent class's initializer before the child class's initializer is that the parent class doesn't know about the child class, so the parent class shouldn't be expected to successfully initialize something that has already been modified by the child class. On the other hand, the child class does know about its parent classes and can be designed to handle the result of whatever initialization the parent class has done. -Keshav ---- Join us in #sagemath on irc.freenode.net ! -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org