#11316: Weighted degree term orders added
--------------------------------+-------------------------------------------
   Reporter:  klee              |          Owner:  AlexGhitza  
       Type:  enhancement       |         Status:  needs_review
   Priority:  minor             |      Milestone:  sage-4.7.1  
  Component:  basic arithmetic  |       Keywords:              
Work_issues:                    |       Upstream:  N/A         
   Reviewer:                    |         Author:  Kwankyu Lee 
     Merged:                    |   Dependencies:              
--------------------------------+-------------------------------------------

Comment(by klee):

 To Simon,

 I should say, I also don't like double underscored attributes. I just
 inherited them from previous authors of the class.

 The unpickling problem is more complicated than what you think. There is a
 change in not only in the data structure but also in the logic. I made
 this change in order to deal with block term orders of whatever
 constituent term orders.

 Therefore the solution you suggest is not suitable to solve this problem.
 Also in my point of view, even if it's possible, it would introduce lots
 of code into the main body of the TermOrder class, just to solve the
 unpickling problem of old objects!

 I believe using __setstate__ method is the most simple and natural way to
 solve the problem. Actually, this is the way the Python documentation,
 which I quoted in the sage-dev thread, recommends to solve such problems.
 The documentation also suggest to put the version information into the
 pickled objects, which I think is a nice way to build the infrastructure
 that I suggested in the sage-dev thread. Let me expound on this more in
 the following.

 Let's assume pickled objects have "_version" attribute with them. This
 attribute may be added only just before pickling. Then a developer, who
 made a big change in the logic and data of the class of the objects, add a
 translating method for the objects pickled before this change to the
 class, perhaps with a name like "_translate_for_sage_4_7" or
 "_upgrade_for_sage_4_7". The translating method is automatically invoked
 by __setstate__ method in the SageObject class when unpickling objects
 before Sage 4.7, perhaps with issuing a warning message to the user.
 Another developer may add another translating method like
 "_translate_for_sage_4_8". Then unpickling procedure invoke the two
 traslating method sequentially so that old objects is translated first for
 Sage 4.7 then for Sage 4.8. Of course, this is only sketchy and to be
 elaborated much.

 I guess without such an infrastructure, developers will get discouraged to
 change internals of classes to enhance Sage, because of the inevitable
 unpickling problem.

 By the way, it is easy to change the double underscored attributes into
 single underscored ones with __setstate__ method.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11316#comment:17>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to