On Jul 18, 2008, at 1:53 PM, Arnaud Bergeron wrote:

> In the _mul_ method I allow concatenation of words of differing
> alphabet as long as all the letters of both words are in one of the
> alphabets.  I would like to keep this behavior but the coercion
> mechanism refuses.  I know I have to tell it either how to do it or
> just that it's possible but how?

Yes. Write a coerce_map_from_impl(self, S) method on your class that  
returns True iff the alphabet of S is a subset of the alphabet of  
self. Then write your __call__ method to do the element creation  
properly.

> Maybe I should just wait for Sage 3.1 and the new model and implement
> that.  Especially if the documentation is much better, I could figure
> it out.

Yes, things should be much cleaner, and I'm also focusing on better  
documentation (gives me something to do every time I touch  
parent.pxd :). Specifically, regarding the instructions above,  
coerce_map_from_impl will become _has_coerce_map_from_ and you will  
edit the _element_constructor_ method rather than __call__.

- Robert


--~--~---------~--~----~------------~-------~--~----~
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://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to