On Mar 20, 2010, at 11:22 AM, Florent Hivert wrote:
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
I was imagining this would be set up automatically.
but this is very likely to leads to very unexpected behavior.
Like?
- Robert
--
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.