| 13 | |
| 14 | I am not proud of this patch's code, but I see NO other way to all these wrongs answers without rewriting the class hierarchy. The fact that a class of finite words is an instance (i.e. it inherits) from a class of infinite words makes it really hard to implement `O_o` |
| 15 | |
| 16 | {{{ |
| 17 | sage: isinstance(Words(4,30), type(Words(3))) |
| 18 | True |
| 19 | }}} |
| 20 | |
| 21 | You cannot be sure, when implementing the `__eq__` method of `Words_all`, that self really represents an infinite class of words. |
| 22 | |
| 23 | Besides, the old code read : |
| 24 | |
| 25 | {{{ |
| 26 | if isinstance(other, Words_all): |
| 27 | return self.alphabet() == other.alphabet() |
| 28 | else: |
| 29 | return NotImplemented |
| 30 | }}} |
| 31 | |
| 32 | I haven't been able to guess when `not (type(self) is type(other))` does not mean that the two classes should not be reported as equal. |
| 33 | Though the old code seems to imply that this can happen. |
| 34 | |
| 35 | If this can happen we need to add a doctest somewhere. |
| 36 | |
| 37 | Nathann |