Given changes with booleans as discussed in
https://groups.google.com/forum/#!topic/sympy/82ls0doW6Nk, I'm trying to develop a new approach to testing the number of True's in Tuple.
With earlier versions of sympy, if
thelist=Tuple(False, True, False)
the following worked
sum(thelist)==1
Now, I'm trying to use the condition
thelist.count(True)==1
with parse_expr.
The following works as expected
In [25]: parse_expr("(True,False,False).count(True)==1", transformations=(auto_symbol, auto_number, split_symbols))
Out[25]: True
but, if I add implicit_multiplication, it breaks.
In [26]: parse_expr("(True,False,False).count(True)==1", transformations=(auto_symbol, auto_number, split_symbols, implicit_multiplication))
---------------------------------------------------------------------------
[snip]
TypeError: unsupported operand type(s) for *: 'builtin_function_or_method' and 'bool'
I don't suppose there is a way to get implicit_multiplication to realize that .count() is a function and it shouldn't replace the function application with a multiplication.
Or are there better ways of determining the number of True's in the Tuple using parse_expr?
Thanks,
Duane