New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade!
Wed Feb 29 07:08:53 EST 2012
On 2/29/2012 9:09, Xah Lee wrote:
> New Science Discovery: Perl Idiots Remain Idiots After A Decade!
> A excerpt from the new book 〈Modern Perl〉, just published, chapter 4
> on “Operators”. Quote:
> «The associativity of an operator governs whether it evaluates from
> left to right or right to left. Addition is left associative, such
> that 2 + 3 + 4 evaluates 2 + 3 first, then adds 4 to the result.
> Exponentiation is right associative, such that 2 ** 3 ** 4 evaluates 3
> ** 4 first, then raises 2 to the 81st power. »
> LOL. Looks like the perl folks haven't changed. Fundamentals of
> serious math got botched so badly.
> Let me explain the idiocy.
> It says “The associativity of an operator governs whether it evaluates
> from left to right or right to left.”. Ok, so let's say we have 2
> operators: a white triangle △ and a black triangle ▲. Now, by the
> perl's teaching above, let's suppose the white triangle is “right
> associative” and the black triangle is “left associative”. Now, look
> at this:
> 3 △ 6 ▲ 5
> seems like the white and black triangles are going to draw a pistol
> and fight for the chick 6 there. LOL.
Sorry, but you're wrong and they're right.
Associativity governs the order of evaluation of a group of operators
*OF THE SAME PRECEDENCE*.
If you write
only the fact the '**' is right associative will tell you that the order is
I remind you that 2^(3^4) != (2^3)^4.
More information about the Python-list