On Wednesday, November 4, 2015 at 2:10:51 PM UTC-8, Eric Gourgoulhon wrote:
>
> Hi sage-dev,
>
> There is an ongoing discussion at #18529 
> <http://trac.sagemath.org/ticket/18529> about defining __eq__ for 
> manifolds and whether one should
> use UniqueRepresentation (which implements equality by id). If anybody has 
> any opinion on this, 
> she/he is welcome to join the discussion. 
>

Avoid UniqueRepresentation if you can. It requires expensive processing of 
construction parameters and hence introduces bad overhead and it introduces 
"global variables" in a way that is much worse than global variables. 

The main reason why UniqueRepresentation is necessary in some cases is 
because the coercion framework requires it to figure out certain things 
efficiently. However, this mainly comes in for coercion discovery. I would 
not expect manifolds to act in any non-trivial way in coercions, so I'm 
pretty sure this is not forcing you to have it.

In general, I don't think there is a real problem if

A = manifold(<construction parameter set 1)
B = manifold(<construction parameter set 1)

has (A is B) equal to False. I would think it's not really a problem if it 
has A == B equal to False.

Indeed, this would mean that manifolds stored in separate pickles would be 
non-equal. However, pickle is smart enough to ensure that

loads(dumps([A,A]))

would again be a sequence of two identical manifolds (they might just be 
distinct from the A you had originally).

-- 
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 post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to