Does range function allows concatenation ? Like i want to make a range(30)
& concatenate it with range(2000, 5002)
. So my concatenated range will be 0, 1, 2, ... 29, 2000, 2001, ... 5001
Code like this does not work on my latest python (ver: 3.3.0)
range(30) + range(2000, 5002)
I came to this question because I was trying to concatenate an unknown number of ranges, that might overlap, and didn't want repeated values in the final iterator. My solution was to use
set
and theunion
operator like so: