On Dec 16, 7:04 am, Dan Christensen <j...@uwo.ca> wrote:
> John H Palmieri <jhpalmier...@gmail.com> writes:
>
> > 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
>
> [...]
>
> > 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.
>
> This name mangling is python's way of having "private" identifiers in a
> class.  You aren't supposed to access things starting with two leading
> underscores outside of the class.  See
>
>  http://docs.python.org/tutorial/classes.html

Hi Dan,

Thanks for the pointer, it helps to clear things up.  Apparently, the
mangling also happens when you access the attribute within the class,
which causes various things to break in the class AlgebraIdeal.  As
William points out, this code is old, and my guess is that it's not
being used for anything.

  John


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to