On Wed, May 27, 2020 at 5:19 AM Alex Hall <[email protected]> wrote:
>
> On Tue, May 26, 2020 at 9:05 PM Chris Angelico <[email protected]> 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 -- [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/JAS5EHWZH3GGJKHXTPW2XOOLYIETT55Q/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to