Hi!

Let P be a parent and P.Element=EC a subclass of Element.
- If EC is a Python class, then P.element_class is a dynamic class
  obtained from EC and from P.category().element_class.
- If EC is a Cython class, then P.element_class is just EC. Why?
  It should still inherit methods from P.category().element_class,
  but (at least according to what I see at #23707) this is not the
  case for __getitem__ (and I guess for other magical methods, too).
- Back to the case that EC is Python. Then, let's consider how
  D = P.element_class (which is a dynamic class!) is pickled. Currently,
  it is pickled as a dynamic class with the bases EC and 
P.category().element_class.
  I believe this is a bug. Namely, if in a newer version of Sage you
  change EC to a Cython class (which I am doing in #23707), unpickling
  an old pickle would still give you the old dynamic class, which in
  the new version is *not* the same as P.element_class.

What I believe should be done:

- Use a dynamic class for P.element_class even if EC is Cython (unless
  there is a compelling reason not to do so, but then please solve the
  inheritance problem for the magical methods provided by the category
  framework)
and/or
- Use the fact that when creating a dynamic class, one can provide
  information on how it should be pickled. Namely, P.element_class should
  be pickled as 
     getattr, (P, 'element_class')
  so that in future it will be guaranteed that when unpickling an old pickle,
  the correct element class would result.

Thoughts?

Best regards,
Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to