Power operator, why does -2**3 throws?

Cyril Auburtin cyril.auburtin at gmail.com
Fri Oct 14 11:30:28 UTC 2016


I would expect `-2**3` to return -8, or `-2**2 == -4`, since it should be
like `-(2**3)`

Firefox gives a clearer error then Chrome with:
> SyntaxError: unparenthesized unary expression can't appear on the
left-hand side of '**'

Is there a reason for this restriction? Python does it `-2**3` fine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20161014/49956cc8/attachment.html>


More information about the es-discuss mailing list