Finding set difference between ranges

tejaswi prakash tejaswidprakash at
Wed Apr 18 00:51:36 EDT 2018

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)

Now, this doesn't seem to make use of the fact that
1. They are sorted
2. They increase in steps of 1 .

Could someone suggest a better way of doing this to make these operations
more efficient?

Thank you,
Tejaswi D Prakash

More information about the Python-list mailing list