power TypeErrors
anton wilson
anton.wilson at camotion.com
Tue Nov 5 16:02:14 EST 2002
I'm trying to understand the possible type errors for **
The language reference states that
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.
I'm running code such as:
1 ** -2
-1.2 ** 0.5
and there is no type error.
How do I generate a type error?
Anton
More information about the Python-list
mailing list