On 2021-09-30 6:08 p.m., Chris Angelico wrote:
> I still think that your use of LookupError is confusing the issue
> somewhat, partly because it's a base class rather than something
> that's ever raised per se.
>
> If you were using a custom exception type, how likely is it that that
> exception would be raised during the unpacking? Under what situations
> would this happen, and might it actually be an intended way for that
> property value to say "actually, heh... I don't exist"? Because the
> logical way to spell that would be "raise PropertyNotFoundError" (or
> whatever you use instead of LookupError). IOW, bubbling is exactly
> correct. You still haven't explained how that isn't the case.
Bubbling is correct, but it doesn't deny that explicit is better than
implicit.
Rust's `?` operator (generally referred to as "try" by the devs) has a
lot that can be learned from, here. (Not to say it would be the
appropriate solution for Python.)
_______________________________________________
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/4324QCNQDUVJZPFZR6BMCEKKV4LT3YVE/
Code of Conduct: http://python.org/psf/codeofconduct/