Hi Robert, >> I wonder if the category infrastructure would support a pervasive >> command like >> >> R=IntegerModRing(7) >> R.promote(Fields(), with_check=True) >> R.category() >> Category of fields >> >> with the construction doing no extra work, and the promote method >> having defaults and exceptions consistent with John and Nick's >> "explicit is better" philosophy? >> >> I had though about is_field doing the upgrade, but I think these sort >> of side-effects are confusing. > > Side effects are confusing in general, especially with cached parents. I > would rather have a change_category method that returns a new object with > the updated category, like > > sage: R=IntegerModRing(7) > sage: R.change_category(Fields()).is_field() > True
This is perfectly doable, except that, all the element created before will still be ring element. More precisely if you write: > sage: R = IntegerModRing(7) > sage: R1 = change_category(Fields()) then you have a brand new parent with no connection to the former one. You can set up a coercion R -> R1 but this is very likely to leads to very unexpected behavior. Cheers, Florent -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org To unsubscribe from this group, send email to sage-devel+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.