Hi,
As per
https://github.com/sympy/sympy/issues/6212, is_real is
deprecated. I just found this:
>>> s = FiniteSet(FiniteSet(1, 2, 3))
>>> s
{{1, 2, 3}}
>>> len(s)
1
>>> s.powerset()
/usr/lib/python3.3/site-packages/sympy-0.7.5_git-py3.3.egg/sympy/functions/elementary/miscellaneous.py:334:
SymPyDeprecationWarning:
is_real has been deprecated since SymPy 0.7.6. Use is_subset(Reals)
instead. See
https://github.com/sympy/sympy/issues/6212 for more info.
if (arg.is_real is False) or (arg is S.ComplexInfinity):
/usr/lib/python3.3/site-packages/sympy-0.7.5_git-py3.3.egg/sympy/core/basic.py:577:
SymPyDeprecationWarning:
is_real has been deprecated since SymPy 0.7.6. Use is_subset(Reals)
instead. See
https://github.com/sympy/sympy/issues/6212 for more info.
is_real = self.is_real
{EmptySet(), {{1, 2, 3}}}
In my opinion, the deprecation warnings should be shown only when the
library user is invoking the deprecated method/property.
Hence, i think usage of is_real from SymPy's code base should be removed.
For what it's worth, the first is easy:
diff --git a/sympy/functions/elementary/miscellaneous.py
b/sympy/functions/elementary/miscellaneous.py
index 8adf46d..0935b03 100644
--- a/sympy/functions/elementary/miscellaneous.py
+++ b/sympy/functions/elementary/miscellaneous.py
@@ -331,7 +331,7 @@ def _new_args_filter(cls, arg_sequence):
for arg in arg_sequence:
# pre-filter, checking comparability of arguments
- if (arg.is_real is False) or (arg is S.ComplexInfinity):
+ if not arg.is_subset(S.Reals) or arg is S.ComplexInfinity:
raise ValueError("The argument '%s' is not comparable." % arg)
if arg == cls.zero:
What do folks think?
Best,
Amit.