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

Ethan Furman ethan at stoneleaf.us
Thu Apr 30 20:22:55 CEST 2015


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~


More information about the Python-Dev mailing list