This is very similar to the automatic evaluation question that comes
up all the time. If you make things compare equal, then it becomes
impossible to distinguish them. As such, you should reasonably expect
any instance of one to be replaced with another by just about
anything.

A common way around this is to automatically canonicalize things.
Another (probably better) way is to just write your algorithms so that
they are agnostic of structural differences (in other words,
canonicalize at the top of your algorithms instead of in your
constructors).

Aaron Meurer

On Thu, May 2, 2013 at 1:43 PM, Matthew Rocklin <mrock...@gmail.com> wrote:
> I remember being told to never override __eq__.  In general I support this
> policy.
>
> I often implement .equals when I need more mathematical equality checking.
> Perhaps renaming __eq__ to .equals would be better than deletion.
>
>
> On Thu, May 2, 2013 at 2:39 PM, Stefan Krastanov
> <krastanov.ste...@gmail.com> wrote:
>>
>> I have found a few pieces of code where `__eq__` is extended to check
>> for more than structural equality and this causes some routines to
>> fail. Am I right to revert __eq__ to checking only for structural
>> equality (and fixing related tests)?
>>
>> The code in question is `tensor.py` line 1318.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sympy" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to sympy+unsubscr...@googlegroups.com.
>> To post to this group, send email to sympy@googlegroups.com.
>> Visit this group at http://groups.google.com/group/sympy?hl=en-US.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+unsubscr...@googlegroups.com.
> To post to this group, send email to sympy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy?hl=en-US.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to