Hello everyone,

here is a bug that is maybe related to coercion system to Integers in sage:

sage: W = Words(4)  
sage: W([1,2])
word: 12
sage: W([1,2]) in QQ
False
sage: W([1,2]) in ZZ
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
<ipython-input-30-ef733470b649> in <module>()
----> 1 W([Integer(1),Integer(2)]) in ZZ
[...]

NotImplementedError: please implement _an_element_ for Words over {1, 2, 3, 
4}

It is easy to fix by adding the _an_element_ method to W by doing:

sage: W._an_element_ = lambda : W()
sage: W([1,2]) in ZZ
False

but maybe is it hiding a more tricky problem behind ?

Aladin

PS: this post is in the continuity of a topic I originally opened on 
sage-support: 
https://groups.google.com/forum/#!topic/sage-support/uvKWkq7wDVM

-- 
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/groups/opt_out.

Reply via email to