semantics of ** (unexpected/inconsistent?)

MRAB python at mrabarnett.plus.com
Mon Nov 30 13:00:06 EST 2009


Lie Ryan wrote:
> On 11/30/2009 12:38 PM, Esmail wrote:
>> Thanks all!! I get it now :-)
>>
>> It helped to have a number of different explanations, thanks
>> for taking the time to post. Much appreciated.
> 
> I generally do not expect operator precedence to be reliable at all 
> except for:
> 
> + - (binary ops, not the unary)
> * /
> **
> 
> for other operators I would have explicit parens. It's too much work to 
> remember the rest of the precedence sheet.

Most programming languages don't differentiate in text between the
number "negative 3" and the expression "negated 3". APL does. The former
is written as "¯3" (3 preceded by the overscore character) and the
latter as "-3" (3 preceded by the minus sign).



More information about the Python-list mailing list