On 9 Mrz., 06:30, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote:
> Hard Exceptions: terminate the program unless explicitly silenced > Soft Exceptions: pass silently unless explicitly caught > > In this case, I agree with the Zen of Python ("import this"): > > Errors should never pass silently. > Unless explicitly silenced. Exceptions in Python don't necessarily signal errors. Just think about StopIteration. Note also that the common practice of letting *possible* errors passed silently is to return None instead of raising an exception. Moreove people create boilerplate like this try: k = lst.index(elem) ... except IndexError: pass instead of with lst.index(elem) as k: ... It would be interesting to think about SoftException semantics for such clauses: lst.index would neither raises a HardException nor does it return None but leads to skipping the with-block. Is it really so exotic that it requires the demand for more use cases? -- http://mail.python.org/mailman/listinfo/python-list