unsupported operand type(s) for ^: 'float' and 'float'

benc benc.nospam at gmail.com
Fri Jun 15 15:39:17 CEST 2007


On Jun 15, 9:21 am, Florian Lindner <Florian.Lind... at xgm.de> wrote:
> >>> 5.3^4.3
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: unsupported operand type(s) for ^: 'float' and 'float'

That operator... I do not think it means what you think it means.

>>> hex(0x1010^0x0110)
'0x1100'

^ is the bitwise XOR operator.  For exponentiation, use **.

>>> 5.3**4.3
1301.326396639844

Hope that helps,
--Ben




More information about the Python-list mailing list