#13814: LazyFamily.__eq__ gives false positives.
------------------------------------+---------------------------------------
Reporter: cnassau | Owner: sage-combinat
Type: defect | Status: needs_review
Priority: major | Milestone: sage-5.6
Component: combinatorics | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Christian Nassau | Merged in:
Dependencies: | Stopgaps:
------------------------------------+---------------------------------------
Comment (by nthiery):
Hi Christian,
Thanks for your changes!
Replying to [comment:18 cnassau]:
> > Should I remove the previous patch? Then we won't have to specify
> > which patch to apply.
Done.
> This is really an issue with {{{sage.misc.fpickle}}}: the function "``n
-> Permutations(n)``" can be pickled, but the unpickled version has
forgotten the default value of the second argument of
{{{Permutations(n,k)}}}:
> ...
I see!
Yes, this is definitely a misfeature with sage.misc.fpickle. It should
be fixed to use standard pickling when it can (e.g. for a function
defined in a library). And it should return something that can be
unpickled with a plain loads. And, as mentioned in the code of family
it should be registered to copy_reg so that it would be called
automatically by dumps without needing to pollute one's code (like
family) with it. Would you be so kind as to open a ticket about this
if there is not already one?
In order to separate the two issues, what about changing the failing
examples to use Partitions (which pickles smoothly), rather than
making it more complicated with some workaround that won't be needed
hopefully sometime soon, and is not vital for most users?
> > Where is ``!=`` implemented?
>
> That's a good question: ``grep`` could find a handful of {{{__ne__}}} in
the Sage code base, but none that would be a candidate for
{{{LazyFamily.__ne__}}}. The python manual clearly says that one should
define {{{__ne__}}} if {{{__eq__}}} is defined; that appears not to be the
case in class {{{SageObject}}}, so my guess is that Python is using a
default implementation.
Ok. Then you may want to explicitly implement __ne__ as not __eq__,
just to be sure.
> By the way, both {{{Parent}}} and {{{SageObject}}} seem to test the
consistency of {{{__eq__}}} and {{{__ne__}}} in the test suite.
That's good :-)
Cheers,
Nicolas
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13814#comment:19>
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.