Why does 1**2**3**4**5 raise a MemoryError?

Alex foo at email.invalid
Sun Mar 31 20:39:56 EDT 2013


Chris Angelico wrote:

> 
> Opening paragraph, "... exponentiation, which groups from right to
> left". It follows the obvious expectation from mathematics. (The OP is
> using Python 2, but the same applies.)

Thanks. I did miss that parenthetical comment in para 6.15, and that
would have been the correct place to look, since it appears that
operators are not parts of expressions, but rather separate them. Is
that the "obvious expectation from mathematics," though? Given that

  3
 5
4

(i.e.: 4**5**3) is transitive, I would have expected Python to exhibit
more consistency with the other operators. I guess that is one of the
foolish consistencies that comprise the hobgoblins of my little mind,
though.



More information about the Python-list mailing list