On Jul 5, 2009, at 10:23 PM, smichr wrote: > > > > On Jul 4, 7:50 pm, Christophe <projet...@gmail.com> wrote: >>> Python has a builtin set data type. For example: >> >>>>>> x= [1,2,3,5,2,1] >>>>>> set(x) >> >>> set(1, 2, 3, 5) >> >>> Sympy has an Interval class, but it seems at the moment it doesn't >>> have things like the intersection / union operators, nor whether the >>> interval is open or closed. >> >>> I'm not sure if this Interval class was intended for the application >>> you mentioned, but if so, we should add some functionality, it >>> wouldn't be very hard. The file is: >>> sympy/core/interval.py >> > > The interface would have to be changed to take a descriptor of whether > the set is open or closed, wouldn't it? But maybe you could make the > start and end values be a tuple and change the corresponding start and > end property definitions. So you could create an interval (3,4] like > > Interval((3,0),(4,1)) > I think a default argument would be better, like Interval(3, 4, endpoints='oc'), which would create (3, 4] ('oc' stands for open-closed).
> And the default could be a closed set (i.e. Interval(3,4) would be > [3,4]) I agree, make 'cc' the default. Aaron Meurer > > There is a package available that already handles intervals as has > been requested that is available at > > http://members.cox.net/apoco/interval/ > > I found this on the listing of packages at http://pypi.python.org/ > pypi/ > . > > /c > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sympy?hl=en -~----------~----~----~----~------~----~------~--~---