On 5/21/07, Michel <[EMAIL PROTECTED]> wrote:
>
> What about my example:  constant polynomials to elements of the base
> ring.
>
> In this case it seems *much more natural* to put the logic in
> PolynomialRing
> than to pollute the __call__ method of every possible ring.
>
> There are many more examples like this.

I think I understand what you're suggesting now.  Namely that
in addition to __call__, there is another method that __call__ will
call if it fails, which takes an object as input.

def _noncanonical_into_(self, R):
     """
     Tries to return some sort of reasonable coercion
     of self to an element of R.
     """
     ...

Then you're proposing that PolynomialRing would define a
_noncanonical_into_ method which,
if self is constant, would coerce the constant term
into R and return that element of R.   If self is not constant,
the natural thing would be to call R(self), which would of
course result in an infinite loop.

I'm concerned that your proposal, if I understand it correctly,
will make it difficult to avoid infinite loops.  Could you flesh
out your proposal more, and specifically address issues
involving infinite loops?

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