Le jeudi 5 novembre 2015 01:57:27 UTC+1, Nils Bruin a écrit : > > 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 >
A priori, in a typical working session, not so many manifolds should be constructed, so this might not be a problem > and hence introduces bad overhead and it introduces "global variables" in > a way that is much worse than global variables. > > Ah? OK. > 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. > Thanks for these explanations. > 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). > But, as I said in comment 46 on the ticket, there will be a problem with the _test_pickling method, which is checking loads(dumps(A)) == A. Shall we redefine _test_pickling, which is inherited form SageObject? -- 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.