[pyar] Bitwise not..

Claudio Freire klaussfreire en gmail.com
Mar Jun 15 15:18:21 ART 2010


2010/6/15 Roberto Alsina <ralsina en netmanagers.com.ar>

> On Tuesday 15 June 2010 14:37:38 Claudio Freire wrote:
> > On Tue, Jun 15, 2010 at 1:50 PM, david weil <tenuki en gmail.com> wrote:
> > > Segun http://docs.python.org/release/2.5.2/ref/bitwise.html no hay
> > > operador not bitwise.. alguien lo resolvio de forma simpatica??
> >
> > Definitivamente, ñuflo
> >
> > >>> ~1
> >
> > -2
> >
> > >>> ~0
> >
> > -1
>
> ...
>
> En python que los enteros no tienen representación fija, como hace? no sé,
> no
> entiendo del todo.
>

Sí la tienen.

http://docs.python.org/reference/datamodel.html#the-standard-type-hierarchy

Los enteros simples (int) son del tamaño de palabra nativo de la máquina
donde corre python.

Los enteros largos sí son otro bicho, pero como operan en complemento a dos,
en general "~" se comporta bien (cuando se extiende la longitud de un número
en complemento a dos, se extiende el bit de signo).
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://listas.python.org.ar/pipermail/pyar/attachments/20100615/41f02e71/attachment.html>


More information about the pyar mailing list