<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 17 October 2017 at 16:32, Nick Coghlan <span dir="ltr"><<a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>So this sounds like a reasonable API UX improvement to me, but you'd need to ensure that you don't inadvertently change the external behaviour of *successful* containment tests.<br></div></div></div></div></blockquote><div><br></div>I should also note that there's another option here beyond just returning "False": it would also be reasonable to raise an exception like "RuntimeError('Attempted negative containment check on infinite iterator')".</div><div class="gmail_quote"><br></div><div class="gmail_quote">That way currently working code would be semantically unchanged, but code that otherwise results in an infinite loop would turn into an immediate exception instead.</div><div class="gmail_quote"><br></div><div class="gmail_quote">The rationale for this approach would be "What you are trying to do doesn't really make sense, so we're going to complain about it, rather than just giving you an answer".</div><div class="gmail_quote"><br></div><div class="gmail_quote">The rationale against the error is that "If this item is present, advance past it, otherwise don't do anything" would be an at least arguably reasonable operation to request.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Whether "x in itr" is a reasonable *spelling* of that operation would then be a different question that still favoured the "raise an exception" approach.<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">Cheers,</div><div class="gmail_quote">NIck.<br></div><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Nick Coghlan   |   <a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>   |   Brisbane, Australia</div>
</div></div>