Would it be better to have a UnitaryRing subclass?  It'd be a bit more
work but would be a bit more natural since not all rings have a unit.

On 5/24/07, Nick Alexander <[EMAIL PROTECTED]> wrote:
>
> David Harvey <[EMAIL PROTECTED]> writes:
>
> > On May 24, 2007, at 1:53 PM, Michel wrote:
> >
> >>
> >> My apologies if I have misunderstood things. I am doing some pyrex
> >> programming and I see there are many pitfalls (like writing !=None :-)
> >>
> >> I encountered the following problem:
> >> If I understand correctly then rings have a _zero_element attribute
> >> but not a _unit_element
> >> attribute. Since you often want to initialize something to 1, not
> >> having a unit element is inconvenient.
> >>
> >> Of course you can create the unit element as R(1) but this seems to be
> >> expensive and has
> >> unpredicable performance (it depends on the implementation of the
> >> __call__ method of R).
> >> Furthermore you want there to be a unique unit element for efficiency
> >> of testing.
> >>
> >> So unless I have misunderstood things (which is quite likely) I would
> >> propose to give
> >> rings a _unit_element attribute which is initialized in the
> >> constructor.
> >
> > Strong +1 for this. I can't believe we don't already have it :-)
> >
> > Not sure I would want it called _unit_ though, makes me think rather
> > of invertible elements. How about _one_, or _unity_?
>
> +1 to _one_.
>
> Nick
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to