Repository: sympy/sympy
File: sympy/logic/boolalg.py (Python)

Code before:
        for a, b in remove:
            argset.remove(a)
            argset.remove(b)
        if len(argset) == 0:
            return false
        elif len(argset) == 1:
            return argset.pop()
        elif True in argset and remove_true:
            argset.remove(True)
            return Not(Xor(*argset))
        return super().__new__(cls, *ordered(argset))

    def to_nnf(self, simplify=True, form=None):
        if form == 'dnf':
            terms = []
            for mask in _get_odd_parity_terms(len(self.args)):
                conj = [self.args[i] if mask[i] == 1 else Not(self.args[i])
                        for i in range(len(self.args))]
                terms.append(And(*conj))
            return Or._to_nnf(*terms, simplify=simplify)
        else:
            args = []
            for i in range(0, len(self.args)+1, 2):
                for neg in combinations(self.args, i):
                    clause = [Not(s) if s in neg else s for s in self.args]
                    args.append(Or(*clause))
            return And._to_nnf(*args, simplify=simplify)

    def _eval_rewrite_as_Or(self, *args, **kwargs):
        a = self.args
        return Or(*[_convert_to_varsSOP(x, self.args)
                    for x in _get_odd_parity_terms(len(a))])

    def _eval_rewrite_as_And(self, *args, **kwargs):
        a = self.args
        return And(*[_convert_to_varsPOS(x, self.args)
                     for x in _get_even_parity_terms(len(a))])

    def _eval_simplify(self, **kwargs):
        # as standard simplify uses simplify_logic which writes things as
        # And and Or, we only simplify the partial expressions before using
        # patterns
        rv = self.func(*[a.simplify(**kwargs) for a in self.args])
        rv = rv.to_anf()
        if not isinstance(rv, Xor):  # This shouldn't really happen here
            return rv
        patterns = _simplify_patterns_xor()
        return _apply_patternbased_simplification(rv, patterns,
                                                  kwargs['measure'], None)

    def _eval_subs(self, old, new):

Review comment (suggestion):
```suggestion
                    args.append(Or(*clause, evaluate=False))
```

Code after:
        for a, b in remove:
            argset.remove(a)
            argset.remove(b)
        if len(argset) == 0:
            return false
        elif len(argset) == 1:
            return argset.pop()
        elif True in argset and remove_true:
            argset.remove(True)
            return Not(Xor(*argset))
        return super().__new__(cls, *ordered(argset))

    def to_nnf(self, simplify=True, form=None):
        if form == 'dnf':
            terms = []
            for mask in _get_odd_parity_terms(len(self.args)):
                conj = [self.args[i] if mask[i] == 1 else Not(self.args[i])
                        for i in range(len(self.args))]
                terms.append(And(*conj, evaluate=False))
            return Or._to_nnf(*terms, simplify=simplify)
        else:
            args = []
            for i in range(0, len(self.args)+1, 2):
                for neg in combinations(self.args, i):
                    clause = [Not(s) if s in neg else s for s in self.args]
                    args.append(Or(*clause, evaluate=False))
            return And._to_nnf(*args, simplify=simplify)

    def _eval_rewrite_as_Or(self, *args, **kwargs):
        a = self.args
        return Or(*[_convert_to_varsSOP(x, self.args)
                    for x in _get_odd_parity_terms(len(a))])

    def _eval_rewrite_as_And(self, *args, **kwargs):
        a = self.args
        return And(*[_convert_to_varsPOS(x, self.args)
                     for x in _get_even_parity_terms(len(a))])

    def _eval_simplify(self, **kwargs):
        # as standard simplify uses simplify_logic which writes things as
        # And and Or, we only simplify the partial expressions before using
        # patterns
        rv = self.func(*[a.simplify(**kwargs) for a in self.args])
        rv = rv.to_anf()
        if not isinstance(rv, Xor):  # This shouldn't really happen here
            return rv
        patterns = _simplify_patterns_xor()
        return _apply_patternbased_simplification(rv, patterns,
                                                  kwargs['measure'], None)

    def _eval_subs(self, old, new):