On Wed, May 27, 2020 at 5:19 AM Alex Hall <alex.moj...@gmail.com> wrote:
>
> On Tue, May 26, 2020 at 9:05 PM Chris Angelico <ros...@gmail.com> wrote:
>>
>> And the "is this name bound" check would potentially
>> have other value, too.
>
>
> Can you think of any examples?

When you're looping, searching for something, and then seeing if you
found any. If you want to stop at the first, you can use 'break' and
'else' (although a lot of people don't know about that), but what if
you're locating the last match, and can't search in reverse? Or some
sort of  best match or all match? How do you then say "none found"?
Usually you end up needing a sentinel, but if you could simply leave
the variable unbound, you could then check for that at the end.

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/JAS5EHWZH3GGJKHXTPW2XOOLYIETT55Q/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to