On 4/18/07, Nick Alexander <[EMAIL PROTECTED]> wrote:
> Martin Albrecht <[EMAIL PROTECTED]> writes:
> > Almost, done. Exception:
>
> This list of exceptions is interesting.  Is it possible that is_zero
> is in the wrong place in the hierarchy?

It's in the only place it can go.  Putting it in SageObject wouldn't
make sense.  Possibly there should be another is_zero in the
base module or ring class.    I have some comments below about each
exceptional case, by the way.

> And the precision issues are more widespread; is_zero for reals, etc,
> has the same issues.

Reals and complexes do not have this issue because in SAGE they are
all fixed precision fields -- there are no lazy reals in SAGE (not
yet, at least).

> Other than that, +1 include from me.

Many thanks for looking it over!!

> > ./libs/ntl/ntl.pyx:    def is_zero(self):
> > ./libs/ntl/ntl.pyx:    def is_zero(self):
> > ./libs/ntl/ntl.pyx:    def is_zero(ntl_GF2E self):
> > ./libs/ntl/ntl.pyx:    def is_zero(self):
> >
> > Does not inherit from Element.

When I wrote the ntl interface I viewed it as attempting
to model as close as possible the actual C++ interface
to the NTL library.  The idea was not to make something
that behaved like other SAGE rings, but to provide an
easier path to quickly use NTL in implementing other
SAGE rings and objects.

> > ./modular/hecke/module.py:    def is_zero(self):
> >
> > Does not inherit from Element.

That thing inherits from Module, which is defined
in module.pyx.  I think here we either don't have
an is_zero method in modulear/hecke/module.py
or we move it to modules/module.pyx, and define
__nonzero__ -- i.e., the same as was done for elements.

> > ./structure/element.pyx:    def is_zero(self):
> >
> > Does not inherit from Element.

Um -- that is element ?? Huh?   It doesn't inherit from itself ?

> > ./rings/morphism.py:    def is_zero(self):
> >
> > Does not inherit from Element.

That's bad.  Ring morphisms are elements so should
inherit from element.  That they don't is a mistake.

> > ./rings/number_field/number_field_ideal.py:    def is_zero(self):
> > ./rings/number_field/number_field_ideal.py:    def is_zero(self):
> >
> > Does not inherit from Element.

I think ideals should also be elements of a group of fraction ideals,
or at least of something.

> > ./rings/padics/padic_lazy_element.py:    def is_zero(self, prec):
> > ./rings/padics/padic_capped_relative_element.py:    def is_zero(self, prec =
> > None):
> > ./rings/padics/padic_extension_generic_element.py:    def is_zero(self, 
> > prec):
> > ./rings/padics/padic_ring_fixed_mod_element.py.orig:    def is_zero(self, 
> > prec
> > = None):
> > ./rings/padics/local_generic_element.py:    def is_zero(self, prec):
> > ./rings/padics/padic_ring_fixed_mod_element.py:    def is_zero(self, prec =
> > None):
> >
> > Require additional prec parameter which doesn't fit into the __nonzero__
> > concept, so I left it as is. Ideas?

I think that should be left as is.  At least I don't have any better ideas.

William

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