Finding set difference between ranges
tejaswi prakash
tejaswidprakash at gmail.com
Fri Apr 20 06:34:40 EDT 2018
I generate the values using range and then convert them to sets.
I am thinking about an approach which involves subtracting the ranges, or
something along those lines, nothing concrete yet.
On Wed 18 Apr, 2018, 8:43 PM Neil Cerutti, <neilc at norwich.edu> wrote:
> On 2018-04-18, tejaswi prakash <tejaswidprakash at gmail.com> wrote:
> > Hello all,
> > I have 3 continuous (steps of 1) ranges a,a1,a2. All of them sorted.
> > I am performing the following operations on them
> >
> > a = a.difference (a1)
> > a = a.difference(a2)
>
> If they are each stored as a set I don't see how they can be
> sorted. Are you converting to set and then calling difference?
>
> It may still be more efficient than writing your own loop to take
> advantage of the sorted status of the original objects.
>
> --
> Neil Cerutti
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list