I think on this point at lot of people will have to agree to disagree. The
clear advantage for me is that the `ZeroDivisionError` that is naturally part
of `div` is made explicit and handled in a type safe way (given than one is
using a type checker like mypy). Especially in this example I can't for the
life of me think of a situation where I would not have a `try`/`except`
directly surrounding the regular `div` with exceptions and instead let the
exception bubble up the stack and have something like
```
try:
do_lots_of_arithmetic() # code that calls div and any other similar function
except EveryArithmeticErrorYouCanThinkOf: # very bad design imho.
print('ooops something went wrong')
```
>From a cultural perspective (with python traditionally not being written in
>this style) I think writing code like this at the level of internal library
>code (that the user of the library will not see when using the library) is
>perfectly fine.
_______________________________________________
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/NXUC2NFJR2XTVEJ4FKDKTLHDQLT4HXF5/
Code of Conduct: http://python.org/psf/codeofconduct/