Equivalent(x, y) sometimes prints as Equivalent(x, y) and sometimes as Equivalent(y, x). I haven't checked if it's not sorting the .args or if the issue is just with the printer.
Comment #1
Posted on Oct 31, 2013 by Happy GiraffeLooks like a printer issue: the string printing of Equivalent falls back to the _print_Basic method, while other BooleanFunction subclasses such as And, Or have their own _print_And and _print_Or methods that sort the args.
Comment #2
Posted on Nov 3, 2013 by Happy ElephantDoesn't that mean it's an args ordering issue then?
Comment #3
Posted on Nov 3, 2013 by Happy GiraffeI assume it's a design decision to have BooleanFunction not sort their args.
Comment #4
Posted on Nov 4, 2013 by Happy ElephantOK, looking at the code, it has nothing to do with BooleanFunction. BooleanFunction is just a Boolean Function, so it does sort its args (as it should). And and Or are lattice operations, but LatticeOp also sorts the args (it internally uses _argset in case .args is never used). It's Equivalent.new directly that does this, when it calls *set(args). It should use the same methodology as LatticeOp with _argset.
Comment #5
Posted on Nov 4, 2013 by Happy ElephantComment #6
Posted on Nov 5, 2013 by Happy GiraffeSo can we remove the sorting from the _print_And and _print_Or methods?
Comment #7
Posted on Nov 5, 2013 by Happy ElephantPrinting sorting and arg sorting aren't always the same. So we'd have to check.
Comment #8
Posted on Mar 5, 2014 by Happy ElephantWe have moved issues to GitHub https://github.com/sympy/sympy/issues.
Comment #9
Posted on Apr 6, 2014 by Happy RabbitMigrated to http://github.com/sympy/sympy/issues/7180
Status: Started
Labels:
Type-Defect
Priority-Medium
Logic
Printing
Restrict-AddIssueComment-Commit