osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Finding set difference between ranges


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