Hi

The present behaviour is:
    >>> len()
    TypeError: len() takes exactly one argument (0 given)

    >>> len(1, 2)
    TypeError: len() takes exactly one argument (2 given)

This is nothing special about built-ins. The same goes for:
    >>> def f(): pass
    >>> f(1)
    TypeError: f() takes 0 positional arguments but 1 was given

I find this behaviour perfectly satisfactory. The OP's problem can be
resolved by looking at the exception, whose type is TypeError.

For this to be completely reliable, certain aspects the exception message
need to be stable. It may be worth stating that this will be done, at least
for certain exception.

By the way, using the exception instance will produce code that works with
earlier versions of Python.

-- 
Jonathan
_______________________________________________
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/CLC5PF3LY4FELGWG7DIE2W2X3SKJXJKC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to