Re: [Python-Dev] TypeError messages

2015年2月21日 12:55:57 -0800

On Sat Feb 21 2015 at 12:15:25 PM Antoine Pitrou <[email protected]>
wrote:
> On 2015年2月20日 14:05:11 +0000
> Brett Cannon <[email protected]> wrote:
> > On Thu Feb 19 2015 at 5:52:07 PM Serhiy Storchaka <[email protected]>
> > 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.
>
> So it should be "expected X, but got Y".
>
> Personally, I think the "but" is superfluous: the contradiction is
> already implied, so "expected X, got Y" is terser and conveys the
> meaning just as well.
>
I'm also fine with the terser version.
-Brett
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to