#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 SimonKing):
I was reading part of the second patch. So, this is only part of a review.
Concerning double versus single underscore: I would not insist on a single
underscore. After all, Python has the concept of private attributes for a
reason, and certainly the degree weights are private. However, if I write
code then I usually avoid double underscores, because I don't like the
name mangling. I guess it's a matter of taste.
Certainly, one way (not necessarily the easiest way) to solve the
unpickling problem is to write a `__setstate__` method. That is what you
do in the second patch. However, it seems awkward to create a whole new
termorder inside `__setstate__` (line 523 of the second patch) just in
order to get a value to update a dictionary with. Wouldn't it be easier to
compute the missing item (the default value of `__weights`) directly?
In addition, it seems to me that one does not need to introduce a
`__setstate__` method in order to solve the unpickling problems.
Introducing a class attribute `_weights` (resp. `__weights`, but I don't
know if there is a pitfall related with name mangling of class attributes)
providing a default value should be enough to solve the problem. If one
follows that approach, probably the default value would be None. Then, the
methods using `__weights` should be modified so that the case
`__weights==None` is correctly dealt with.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11316#comment:16>
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.