Re: [Python-Dev] PEP 492 vs. PEP 3152, new round

2015年4月30日 11:25:08 -0700

On 04/30, Yury Selivanov wrote:
> On 2015年04月30日 1:56 PM, Ethan Furman wrote:
> I still want to see where my current grammar forces to use
> parens. See [1], there are no useless parens anywhere.
 --> await -coro()
 SyntaxError
 --> await (-coro()) # not a SyntaxError, therefore parens are
 # forced
>> In other words, a SyntaxError is nat any clearer than "AttributeError: obj
>> has no __neg__ method" and it's not any clearer than "AwaitError: __neg__
>> returned not-awaitable". Those last two errors tell you exactly what you
>> did wrong.
> 
> This is debatable. "obj has no __neg__ method" isn't obvious
> to everyone (especially to those people who aren't using
> operator overloading).
Good news! The error there is actually
 --> -object()
 TypeError: bad operand type for unary -: 'object'
Which is definitely clear, even for those who don't do operator overloading.
--
~Ethan~
_______________________________________________
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