[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-ideas
Subject:    Re: [Python-ideas] BindError as a built-in TypeError subclass (on the margin of PEP 362 discussion)
From:       Chris Rebert <pyideas () rebertia ! com>
Date:       2012-06-11 1:12:36
Message-ID: CAMZYqRR=OP2Y3XRz8VoNguyDMWsr1W_af1EDP9Nni5GaC87rrQ () mail ! gmail ! com
[Download RAW message or body]

On Sun, Jun 10, 2012 at 5:00 AM, Steven D'Aprano <steve@pearwood.info> wrote:
> Chris Rebert wrote:
>
>>> Since this will be an error that beginners see (frequently), I suggest
>>> ArgumentError is more friendly than BindError.
>>
>> I note that Ruby also has an ArgumentError, which it raises both for
>> calls with an incorrect number of arguments and in cases when Python
>> would raise ValueError.
>
> Even if I wanted to replace ValueError with ArgumentError (and I don't), we
> couldn't due to backward compatibility.
>
> (Although I suppose ArgumentError could inherit from both TypeError and
> ValueError.)
>
> My concept is that errors due to the wrong argument count, duplicate or
> missing keyword arguments, etc. which currently raise TypeError could raise
> ArgumentError, a subclass, instead.
>
> That will make distinguishing between "passed the wrong number of arguments"
> from "passed the wrong type of argument" easier.

You seem to have misinterpreted the intent behind my post. I'm in no
way arguing that ValueError and "ArgumentBindingError" should be
conflated. I'm pointing out that another very similar language (Ruby)
has an error of the same name with a very similar purpose (which it
also distinguishes from its TypeError), thus providing further
validation of the use case for the proposed ArgumentBindingError.

Cheers,
Chris
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
http://mail.python.org/mailman/listinfo/python-ideas
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic