Status: Accepted
Owner: [email protected]
CC: [email protected]
Labels: Type-Defect Priority-Medium Polynomial

New issue 2505 by [email protected]: FF(q) is FF(q) should give true
http://code.google.com/p/sympy/issues/detail?id=2505

In [56]: FF(2) is FF(2)
Out[56]: False

In [57]: GF2 = FF(2)

In [58]: GF2_ = FF(2)

In [59]: GF2 == GF2_
Out[59]: True

In [60]: GF2 is GF2_
Out[60]: False

In [61]: GF2_.of_type(GF2.one)
Out[61]: False

This is very non-intuitive. New objects of FF(q) should not be created if one is already there. We could use caching as a solution to this problem, or some sort of a class registry, that I have seen in another part of sympy code.

But if somehow, you want FF(2) is FF(2) to return false, we could just fix so that the of_type works. That is critical to my work.
The .of_type code is

def of_type(self, a):
        """Check if `a` is of type `dtype`. """
        return type(a) is type(self.one)

Just changing is to == would make it work. Or is .of_type is intended to be this way ?

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" 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/sympy-issues?hl=en.

Reply via email to