On Oct 14, 2008, at 1:33 PM, Martin Rubey wrote:

>
> I believe I understood now:
>
> sage: ?parent
> Type:           function
> <snip>
>         Return x.parent() if defined, or type(x) if not.
>
> I wonder why this is a function, and not a method of Parent?

Typically one uses the parent() function when one has an element  
(such as an integer) and wants it's Parent. This is why it's not an  
element of the Parent.

The docstring should have some better examples, e.g.

sage: parent(5)
Integer Ring
sage: parent(1/2)
Rational Field
sage: parent(1.5)
Real Field with 53 bits of precision


> (Am I right that all Sage parents inherit from Parent?  Would be  
> great to know this)

Yes, that is correct.

> Set_object inherits from Set_generic, and does not define a parent  
> method, for
> whatever reason, maybe because the elements of the set need not  
> have a common
> type.
>
> I just saw on
> http://trac.sagemath.org/sage_trac/attachment/ticket/2314/ 
> coerce_2_sets.patch
>
> a patch to primes.py, which, in particular, makes Primes inherit  
> from a new
> class Subset instead of Set_generic.  I guess this adresses the issue.
>
> It would be wonderful to hear either of "yes, correct", or "no, you  
> are
> mistaken".

I'm not sure exactly what your question is, but sets don't really  
have a parent, as the set of all sets is not a category.

- Robert


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@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-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to