Why does 1**2**3**4**5 raise a MemoryError?
Nobody
nobody at nowhere.com
Tue Apr 2 03:40:21 EDT 2013
On Mon, 01 Apr 2013 00:39:56 +0000, Alex wrote:
> Given that
>
> 3
> 5
> 4
>
> (i.e.: 4**5**3) is transitive,
I think you meant "associative", and exponentiation isn't associative,
i.e. (x**y)**z is not, in general, equal to x**(y**z). In fact, (x**y)**z
is equal to x**(y*z).
Conventional mathematical notation interprets the above example as
4**(5**3). (4**5)**3 would be written with 4**5 parenthesised. Python
follows that convention, as do most languages which have an infix
exponentiation operator.
More information about the Python-list
mailing list