On Fri, Jul 27, 2012 at 11:32 PM, Alex <
alex.kan...@gmail.com> wrote:
> There are some discrepancies between the two classes, and I'm not exactly
> sure why.
>
> - AssocOp sympifies arguments in strict mode via _sympify (which is
> anyway just a proxy for sympify(., strict=True) -- is it reasonable to have
> a separate function
> for doing just this?). Anyway, this is an issue when dealing with booleans:
> Xor(True, A) breaks as booleans are obviously not converted. LatticeOp uses
> sympify.
Booleans won't be converted with anything, as we don't have Basic
boolean literal types.
>
> - AssocOp: the is_commutative attribute is overridden by the combination
> __new__()+flatten().
> Both should probably be rewritten to take commutativity (or not) into
> account, this should be fully backward
> compatible, and provide more functionality for virtually nothing.
> This does not happen in LatticeOp() as _new_args_filter rightfully assumes
> commutativity and does flatten()'s job. Notice that LatticeOp derives from
> AssocOp, and provides
> as such its flatten() method. Needs refactoring?
I don't think commutative even makes sense for LatticeOp. commutative
specifically refers to how the class behaves in Mul, which doesn't
make sense for booleans. LatticeOp probably derives from AssocOp
because in theory the one is a sub-type of the other (a lattice
operation is associative).
By the way, in case you haven't already started to figure it out, the
class structure here is not set in stone, or in any way claimed to be
the best (this actually goes for most features in SymPy). If you see
a problem and you think you can do it better, by all means, try it.
Our test suite will give you a good idea of if you're breaking
something or not.
Aaron Meurer
>
> Sorry for bugging you with these comments - I'm trying to understand what's
> going on :)
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To view this discussion on the web visit
>
https://groups.google.com/d/msg/sympy/-/EYNoisCY11oJ.
> To post to this group, send email to
sy...@googlegroups.com.
> To unsubscribe from this group, send email to
>
sympy+un...@googlegroups.com.
> For more options, visit this group at
>
http://groups.google.com/group/sympy?hl=en.