Silly newbie question - Carrot character (^)

Vlastimil Brom vlastimil.brom at gmail.com
Fri Nov 5 09:57:31 EDT 2010


2010/11/5 Matty Sarro <msarro at gmail.com>:
> Hey Everyone,
> Just curious - I'm working on a program which includes a calculation of a
> circle, and I found myself trying to use pi*radius^2, and getting errors
> that data types float and int are unsupported for "^". Now, I realized I was
> making the mistake of using '^' instead of "**". I've corrected this and its
> now working. However, what exactly does ^ do? I know its used in regular
> expressions but I can't seem to find anything about using it as an operator.
> Sadly my google foo is failing since the character gets filtered out.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
Hi,
see
http://docs.python.org/reference/expressions.html#binary-bitwise-operations
for bitwise XOR.
The usage in regular expressions is different, of course;
  hth,
   vbr



More information about the Python-list mailing list