On Fri, Mar 6, 2015 at 3:23 PM, Joachim Durchholz <j...@durchholz.org> wrote:
> Am 06.03.2015 um 21:34 schrieb Aaron Meurer:
>>>
>>> Here's the bottom end of such a stack trace:
>>>
>>>    File "sets/fancysets.py", line 173, in <module>
>>>      class Reals(with_metaclass(Singleton, Interval)):
>>>    File "core/compatibility.py", line 181, in __new__
>>>      return meta(name, bases, d)
>>>    File "core/singleton.py", line 70, in __init__
>>>      the_instance = ctor(cls)
>>>    File "sets/fancysets.py", line 176, in __new__
>>>      return Interval.__new__(cls, -S.Infinity, S.Infinity)
>>>    File "sets/sets.py", line 744, in __new__
>>>      if (end < start) == True:
>>>    File "core/numbers.py", line 1005, in __lt__
>>>      other = other.evalf()
>>
>>
>> I think ideally we should avoid calls like this being run at import
>> time.  To me, this indicates a design issue in the sets.
>
>
> This is the class in question (lines 173 ff in sets/fancysets.py):
>
> class Reals(with_metaclass(Singleton, Interval)):
>
>     def __new__(cls):
>         return Interval.__new__(cls, -S.Infinity, S.Infinity)
>
>
> So it needs Interval and Infinity in its constructor.
> If there's a design problem with that code, I guess it's a pervasive one.

Hmm, I didn't notice that the only reason this class is constructed at
import time is that it uses the Singleton metaclass.

So one of your suggestions is probably the best fix. Your suggestion 2
(or 3, I don't see the difference) sounds like the best plan to me. It
will break down if something at import time calls S.Whatever, but that
should be avoided anyway.

Even so, I'm still not a fan of evalf() being called inside a class
constructor. Pervasive use of evalf is one of the reasons SymPy is
slow.

Aaron Meurer

>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+unsubscr...@googlegroups.com.
> To post to this group, send email to sympy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/54FA1AEA.2010209%40durchholz.org.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6Jd%3DO2tBgTqiEj6tyHa7p0%3DGzcGW1P7LxHMav6wx571JQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to