Re: Exception for parameter errors

March 10, 2020
4:54 a.m.
On Wed, 4 Mar 2020 at 12:33, Chris Angelico <rosuav@gmail.com> wrote:
I **completely** agree. And I add that the change can also be non-breaking, if the new ArgumentError is simply a subclass of TypeError. Yes, it's incorrect, but this way no old code will break. PS: if you read the official docs (https://docs.python.org/3/library/exceptions.html#TypeError):
exception TypeError Raised when an operation or function is applied to an object of inappropriate type.
etc. It's never stated that TypeError should be raised when the number of arguments is invalid, for example. It seems that TypeError itself is saying "now I'm used outside my scope" :-)
1835
Age (days ago)
1835
Last active (days ago)
0 comments
1 participants
participants (1)
-
Marco Sulla