Thank you all, particularly Guido, for your contributions. Having some
examples will help support the exploration of this idea.
Here's a baby example - searching in a nested loop. Suppose we're looking
for the word 'apple' in a collection of books. Once we've found it, we stop.
for book in books:
for page in book:
if 'apple' in page:
break
if break:
break
However, suppose we say that we only look at the first 5000 or so words in
each book. (We suppose a page is a list of words.)
This leads to the following code.
for book in books:
word_count = 0
for page in book:
word_count += len(page)
if word in page:
break
if word_count >= 5000:
break found
if break found:
break
At this time, I'd like us to focus on examples of existing code, and
semantics that might be helpful. I think once we have this, the discussion
of syntax will be easier.
By the way, the word_count example is as I typed it, but it has a typo. Did
you spot it when you read it? (I only noticed it when re-reading my
message.)
Finally, thank you for your contributions. More examples please.
--
Jonathan
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/ECALTXEP7M3YWAQCHLPRWPBJRQKQICBC/
Code of Conduct: http://python.org/psf/codeofconduct/