GNU Info

Info Node: (python2.1-ref.info)power operator

(python2.1-ref.info)power operator


Next: Unary arithmetic operations Prev: Primaries Up: Expressions
Enter node , (file) or (file)node

The power operator
==================

The power operator binds more tightly than unary operators on its left;
it binds less tightly than unary operators on its right.  The syntax is:

     power:         primary ["**" u_expr]

Thus, in an unparenthesized sequence of power and unary operators, the
operators are evaluated from right to left (this does not constrain the
evaluation order for the operands).

The power operator has the same semantics as the built-in `pow()'
function, when called with two arguments: it yields its left argument
raised to the power of its right argument.  The numeric arguments are
first converted to a common type.  The result type is that of the
arguments after coercion; if the result is not expressible in that type
(as in raising an integer to a negative power, or a negative floating
point number to a broken power), a `TypeError' exception is raised.


automatically generated by info2www version 1.2.2.9