Yury Selivanov wrote:
On 2012-06-14, at 4:53 PM, Antoine Pitrou wrote:
On Wed, 13 Jun 2012 22:52:43 -0400
Yury Selivanov <yselivanov...@gmail.com> wrote:
* bind(\*args, \*\*kwargs) -> BoundArguments
Creates a mapping from positional and keyword arguments to
parameters. Raises a ``BindError`` (subclass of ``TypeError``)
if the passed arguments do not match the signature.
Why a dedicated exception class? TypeError is good enough, and the
proliferation of exception classes is a nuisance.
Agree. Will fix this.
It's not broken. Within reason, more specific exceptions are better than less
specific.
I have always considered it a wart that there was no supported way to
programmatically distinguish between (say) len(42) and len("a", "b"). Both
raise TypeError. Why is the second case a type error? It has nothing to do
with the type of either len, "a" or "b".
The introduction of BindError will allow functions to raise a more specific,
and less misleading, exception when they are called with the wrong number of
arguments, or invalid keywords, etc.
--
Steven
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com