On Mar 5, 9:03 pm, Paul Rubin <http://[EMAIL PROTECTED]> wrote:
> Maybe I didn't undrestand the question.  Say maxnum is 30 in your
> example above.  Then as soon as 46 is seen, you can stop checking, I
> thought.

Yes, as long as 29 doesn't follow 46.

inlist = [1, 5, 23, 46, 29, 21]

If you want to preserve the items after 46, then you can't just bail
when you see 46. You need to keep looking at the following values and
comparing them against the boundry conditions. If the the input is
sequential, then this isn't a problem, as all items above 46 are out
of range....but if the input is arbitrary, then you have to look at
each index individually as you know. So it really comes down to if the
data set is ordered or arbitrary as to which approach is more
efficient.

Regards,
Jordan

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to