using Interval method

55 views
Skip to first unread message

Gaurav Dhingra

unread,
Dec 23, 2014, 1:30:28 AM12/23/14
to sy...@googlegroups.com
Hi all, i am new to sympy

> from sympy.sets.sets import Interval
> Interva(0, 1)
[0, 1]
> isinstance([0, 1], Interval)
False #returns False

should not it return True'

Gaurav Dhingra

Sergey Kirpichev

unread,
Dec 23, 2014, 4:45:53 AM12/23/14
to sy...@googlegroups.com
On Tuesday, December 23, 2014 9:30:28 AM UTC+3, Gaurav Dhingra wrote:
> from sympy.sets.sets import Interval
> Interva(0, 1)
    [0, 1]

Pretty-printing is not an exact representation of objects.

But in this case, [0,1] returned by repr() - I think this is
a bug:
In [2]: print(str(Interval(0, 1)))
[0, 1]
In [3]: print(repr(Interval(0, 1)))
[0, 1]
In [4]: print(pretty(Interval(0, 1)))
[0, 1]
In [5]: print(latex(Interval(0, 1)))
\left[0, 1\right]
 
> isinstance([0, 1], Interval)
    False                 #returns False

should not it return True'

[0, 1] is a python list.  Please read https://docs.python.org/3/tutorial
Reply all
Reply to author
Forward
0 new messages