[pyar] Hat symbol: qué hace?

Nahuel Defossé nahuel.defosse en gmail.com
Jue Mayo 24 09:21:55 ART 2012


Hola Matías
El operador sombrerito o circunflejo es el XOR binario. Es la misma
sintaxis que C en este caso.
XOR es un operador binario que toma bit a bit devolviendo 1 si la
entrada es diferente 1 y 0, o 0 y 1; y devuelve 0 en caso de que sean
iguales 0 y 0 ó 1 y 1.

Saludos
Nahuel

El día 24 de mayo de 2012 08:15, Matías Herranz
<matiasherranz en gmail.com> escribió:
> Hola!
>
> Hoy, porque sí, tipeé esto en la consola python:
>
>> >>> 12^23
>
>
> Y dio 27.
>
> Lo cual me llevó inmediatamente a la pregunta: ¿Qué hace el hat-symbol en
> Python?
>
> Después de buscar un ratito, encontré que era un bitwise exclusive or
> (ref: http://docs.python.org/library/operator.html ).
>
> Curiosidad (al menos para mi!) del día!
>
>
> Abrazo!
>
>
> M.-
>
> --
> Matías Herranz <matiasherranz en gmail.com>
> Twitter: @matiasherranz
> CV en LinkedIn: http://www.linkedin.com/in/matiasherranz
>
> "I think computer viruses should count as life. I think it says something
> about human nature that the only form of life we have created so far is
> purely destructive. We've created life in our own image" Stephen Hawking.
>
>
>
> _______________________________________________
> pyar mailing list pyar en python.org.ar
> http://listas.python.org.ar/listinfo/pyar
>
> PyAr - Python Argentina - Sitio web: http://www.python.org.ar/
>
> La lista de PyAr esta Hosteada en USLA - Usuarios de Software Libre de
> Argentina - http://www.usla.org.ar



More information about the pyar mailing list