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

You would, others would not. -2 ** 2 clearly should return 4, shouldn't it?

Is there a reason for this restriction? Python does it `-2**3` fine

Because of the ambiguity it has been decided to make it a syntax error if the two operators are used together. If you want `-(2**3)`, you have to write it like that, and if you want `(-2)**3` you have to write it explicitly as well. See for the full discussion.

- Bergi
es-discuss mailing list

Reply via email to