On Jun 4, 2008, at 7:07 AM, Bill Page wrote:
> Ok (and thanks also for the clarification, David). There are of course > two different uses of "object" here: 1) object of some category, 2) > Python object. All Python objects have a 'type', i.e. belong to some > Python class. > > So in Sage 3.0.2 I observe for example: > > sage: type(1) > <type 'sage.rings.integer.Integer'> > sage: parent(1) > Integer Ring > sage: type(parent(1)) > <type 'sage.rings.integer_ring.IntegerRing_class'> > sage: category(parent(1)) > Category of rings > sage: type(category(parent(1))) > <class 'sage.categories.category_types.Rings'> > > and > > sage: type(1.0) > <type 'sage.rings.real_mpfr.RealNumber'> > sage: parent(1.0) > Real Field with 53 bits of precision > sage: type(parent(1.0)) > <type 'sage.rings.real_mpfr.RealField'> > sage: category(parent(1.0)) > Category of fields > sage: type(category(parent(1.0))) > <class 'sage.categories.category_types.Fields'> > > These seem consistent to me, albeit rather complex. However I am not > sure I understand the following: > > sage: parent(IntegerRing()) > <type 'sage.rings.integer_ring.IntegerRing_class'> > sage: parent(RealField()) > <type 'sage.rings.real_mpfr.RealField'> > > Could you explain why the parent of an object of some category is a > type? I'm not an expert on these things any more, but I can tell you what happened back in the day (when the sage version number was slightly smaller): Only "elements" have real parents. Since ZZ = IntegerRing() is not an "element", it doesn't have a parent. If X does not have a parent, then parent(X) returns the type of X instead. I'm not sure this is a good idea, but there it is. Of course then you're wondering why ZZ is not an element of the category of the rings. That I do not know. But you can try: sage: IntegerRing().parent() to see that IntegerRing() simply doesn't have a parent() method, which is why the global version parent(IntegerRing()) returns the type of IntegerRing() instead. One difficulty with ZZ being both a parent and an element is that Cython does not support multiple inheritance. BTW I should mention that the whole idea of "parents" vs "types" is one of the main conceptual things inherited from Magma. sorry gotta go cannot answer rest of email, hopefully someone else can.... david --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---