Indeed, adding __hash__ to the CDF class seems to fix this specific issue. 
I wonder how many hash we are going to be forced to add..

The next problem is very strange. During the initialisation of the damn I 
symbol (that seems to be responsible for a non-negligible part of our 
startup time), the following code

R = QQ['x']
f = R([-D,0,1])

and the replacement code that I tried

    919     x = polygen(QQ, 'x')
    920     f = x * x - D

both return a polynomial with coefficients [b'1', b'1'], which of course 
does not make any sense..

Le lundi 28 août 2017 14:30:20 UTC+2, Jeroen Demeyer a écrit :
>
> I'm guessing it might be this from 
> https://docs.python.org/3.6/reference/datamodel.html#object.__hash__ 
>
> A class that overrides __eq__() and does not define __hash__() will have 
> its __hash__() implicitly set to None. 
>
>
> Python2: 
>
>  >>> class X(tuple): 
> ...     def __eq__(self, other): return False 
>  >>> hash(X()) 
> 3527539 
>
> Python 3: 
>
>  >>> class X(tuple): 
> ...     def __eq__(self, other): return False 
>  >>> hash(X()) 
> Traceback (most recent call last): 
>    File "<stdin>", line 1, in <module> 
> TypeError: unhashable type: 'X' 
>
>
> Interestingly, Python 2 also acts like this for *extension types* (such 
> as Cython cdef classes) but not for ordinary Python classes. 
>

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to