Hello,
These days FiniteSet enjoys a great deal of attention, mainly because
of the failures similar to the one which shows up in [0]:
File "/tmp/sympy-bot-tmpQK2faH/sympy/sympy/core/sets.py", line 1144,
in sympy.core.sets.element_sort_fn
Failed example:
FiniteSet((1,2), Float, A, -5, x, 'eggs', x**2, Interval)
Expected:
{-5, <class 'sympy.core.numbers.Float'>, <class 'sympy.core.sets.Interval'>,
eggs, x, x**2, {1, 2, 3}, (1, 2)}
Got:
{-5, <class 'sympy.core.sets.Interval'>, <class
'sympy.core.numbers.Float'>, eggs, x, x**2, {1, 2, 3}, (1, 2)}
The principal problem is in the fact that, currently:
* FiniteSet implicitly sorts its elements, and
* FiniteSet can store arbitrary objects, including non-Basic objects.
To sort the objects which not instances of Basic, FiniteSet currently
creates the sort_key in the following way:
Float(1e9+abs(hash(x))).sort_key()
which is (still) very much machine dependent.
This issue was also discussed in [1].
In view of the status quo, my question is as follows: how useful is
the capability of FiniteSet to host any kind of object? Does anyone
use it?
I have seen somewhere in SymPy that something stored a frozendict in a
FiniteSet; this can be substituted by storing a FiniteSet within a
FiniteSet. My strong opinion is that FiniteSet should only be able to
store Basic's, that would be much more consistent with the current
SymPy philosophy as I perceive it.
Sergiu
[0] http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY-cwdDA
[1] https://groups.google.com/d/topic/sympy/pEub9LYInUI/discussion
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.