Comment #3 on issue 3313 by laurence.gonsalves: Function class violates Liskov substitution principle
http://code.google.com/p/sympy/issues/detail?id=3313

Thanks.

I actually came across this while trying to work around issue 3312. The following code works around that issue:

    f = sympy.Function(name)
    f.is_negative = False
    def lt(self, other):
      if type(self) != type(other):
        return type(self) < type(other)
      return self.args < other.args
    f.__lt__ = lt

I tried converting this code to subclass UndefinedFunction rather than monkey-patching, but ran into complications. At least one of __lt__ or is_negative needs to be on the function *application* rather than on the function itself, and I haven't figured out how to make my subclass of UndefinedFunction return my own subclass of AppliedUndef.

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to