The following should show the problem:
sage: from sage.structure.unique_representation import UniqueRepresentation
....:
....: class A(UniqueRepresentation):
....: def __init__(self, v=1):
....: self.v = str(v)
....:
....: A() == A()
....: A() is A()
....: A() == A(1)
True
True
False
My understanding is that UniqueRepresentation wraps around the class
constructor, such that it returns a unique object if the arguments are
exactly the same. You see that in the second check, A() is A(). However,
A() and A(1) have different arguments (one is empty, one is [1]), so
they return distinct objects.
To fix this, I believe you just have to implement _eq_ or __eq__. For my
example, add def __eq__(self, other): return self.v == other.v. (If I am
incorrect, others please correct me!)
Gareth
On 05/02/2024 13:57, 'Martin R' via sage-devel wrote:
At https://github.com/sagemath/sage/pull/37220 I am trying to provide
a construction functor for symmetric functions. I am hitting the
following bug, which I hope is easy to fix if one knows the right magic:
sage: P.<t> = QQ[]
sage: S = SymmetricFunctions(P)
sage: S.jack().P() == S.jack(t=t).P()
False
Can someone help me out?
Martin
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/sage-devel/5e221666-215b-4210-8bc4-15a3744ccb26n%40googlegroups.com
<https://groups.google.com/d/msgid/sage-devel/5e221666-215b-4210-8bc4-15a3744ccb26n%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/sage-devel/47589ce9-8ffa-4545-9ba4-81bfdd806584%40gmail.com.