Am 21.03.2015 um 20:05 schrieb Aaron Meurer:
https://github.com/sympy/sympy/pull/9181

I see, S(0) is not necessary after all.

I stand corrected, but how does this work?

It is doing

0 <= x + 3

which evaluates to

> 0 <= Add(Symbol: x, Integer: 3)

and then calls the __le__ of Add.
However, in the Python docs, it says

> a <= b is equivalent to a.__le__(b)

so I'd have expected it to go into

0.__le__(Add(...))

and try a numeric comparison.

Does SymPy install its own __le__ on int? (Technically possible but I'd be shocked.) Is Python's int.__le__ checking the other operator's type and calling into it? (If yes, is there a reference to that behaviour, or is it a CPython implementation detail?)

I'm confused...

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/550E8BE8.5050104%40durchholz.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to