On Sat, Dec 13, 2008 at 1:46 PM, John H Palmieri <jhpalmier...@gmail.com> wrote: > > I was thinking of adding some doctests, so I was looking at > algebra_ideal.py. Now I'm confused. > > The file has lines (plus some documentation, which I'm omitting): > > class AlgebraIdeal(object): > def __init__(self, A, gens = []): > if not isinstance(A, Algebra): raise TypeError, "Argument A > must be an algebra." > self.__algebra = A > self.__gens = gens > > Now from within sage: > > sage: from sage.algebras.algebra_ideal import * > sage: R.<y,z> = FreeAlgebra(QQ, 2) > sage: J = AlgebraIdeal(R, [y^2]) > > Then J.__gens is not defined, and neither is J.__algebra. Instead, > J._AlgebraIdeal__gens and J._AlgebraIdeal__algebra are defined, with > the appropriate values. > > Questions: > > 1. is this something built into the object class, from which > AlgebraIdeal inherits, or is this happening for some other reason? If > the latter, what's going on? > 2. is the object class the right class to use here? (I would point > that in sage.rings.ideal, Ideal_generic inherits from MonoidElement, > which strikes me as a little odd. I'm not going to worry about > ideal.py right now, but for AlgebraIdeal, perhaps Parent would be the > right class?)
The AlgebraIdea class -- in fact the whole file algebra_ideal.py -- was written by David Kohel before there even was a Parent class in Sage! It was only touched once since then, when John Cremona kindly added a bunch of docstrings. So, rewrite it :-) William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---