On Sat, 21 Feb 2015 21:39:32 +0000 MRAB <python@mrabarnett.plus.com> wrote:
On 2015-02-21 17:14, Antoine Pitrou wrote:
On Fri, 20 Feb 2015 14:05:11 +0000 Brett Cannon <brett@python.org> wrote:
On Thu Feb 19 2015 at 5:52:07 PM Serhiy Storchaka <storchaka@gmail.com> wrote:
Different patterns for TypeError messages are used in the stdlib:
expected X, Y found expected X, found Y expected X, but Y found expected X instance, Y found X expected, not Y expect X, not Y need X, Y found X is required, not Y Z must be X, not Y Z should be X, not Y
and more.
What the pattern is most preferable?
My preference is for "expected X, but found Y".
If we are busy nitpicking, why are we saying "found Y"? Nothing was *found* by the callee, it just *got* an argument.
Well, it depends on the reason for the message.
If you're passing an argument, then 'found' is the wrong word, but if you're parsing, say, a regex, then 'got' is the wrong word.
I don't think parsing would raise a TypeError, would it? Regards Antoine.