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? > Perhaps another idea, that I could easily implement: We could ensure >> that calling ...Ring.__init__(..., category=False) would initialise the >> ring except for the category framework. Then, the third solution of your >> problem would be >> def __init__(self, i): >> CommutativeRing.__init__(self, i.base_ring(), category=False) >> self._ideal = i >> self._init_category_(CommutativeRings()) # or whatever is >> appropriate >> > > This is similar to my "manual" idea. It is similar, but note that the default is preserved: If category=None (which is the default) or category="some explicitly given category", then initialisation would still occur. Hence, one would postpone category initialisation (by manual intervention) only if the default causes problems. > Would that be acceptable to you? I am happy as long as the category is initialised by default. But perhaps that kind of question should be asked on sage-combinat-devel. A bit later, I'll ask there. Cheers, Simon -- 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