compare range objects

Y

Yingjie Lan

Hi, 

Is it possible to test if two range objects contain the same sequence of integers by the following algorithm in Python 3.2?

1. standardize the ending bound by letting it be the first excluded integer for the given step size.
2. compare the standardized starting bound, ending boundand step size: two ranges equal if and only if this triplet is the same.

If that's correct, it would be good to have equality comparison on two ranges. 

Further, it might also be good to have sub-sequence test on ranges without enumerating it.

Cheers,

Yingjie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,998
Messages
2,570,242
Members
46,834
Latest member
vina0631

Latest Threads

Top