unsigned integers

Anton Vredegoor anton at vredegoor.doge.nl
Thu Mar 6 15:33:08 EST 2003


On Thu, 06 Mar 2003 14:35:13 GMT, "Giovanni Bajo" <noway at sorry.com>
wrote:

>I have some troubles with signed/unsigned integers, probably because it is
>still not clear to me how Python works with respect to this. Especially:

Python has two kinds of integers "under the hood". The first kind is
used for small integers and for internal functions like indexing a
list. 

If the result of a computation exceeds the range of the small integers
(but alas not in case of indexing) the integer is -silently- converted
to a long integer.

I could say more about this but I won't since there seems to be a very
old curse on bit-twiddling and recently there's also some unstability
among the bots [1] so I'll refrain for now.

Anton.


[1] This is probably tangential to your question but I'll list the
reasons anyway:

- One bot became rebellious and had to be taken off line
- an other bot randomly attacks patch submitters (luckily it's using a
pseudo random number generator, so it can be forseen, yet ...)
- an other bot got distracted while writing a book so it had to be
recompiled, unfortunately somebody added the 'pedantic' compiler
switch
- yet another bot is gone -hopefully for ever- after furiously
advocating some kind of self recoding project
- various other promising protobots are caught in an endless loop
discussing ternary operators. With one eye they are looking jealously
at Cs question mark, and with the other eye they dare not look at
Lisps 'code is data' paradigm, afraid as they are to melt in the
primeval soup of parens. Yet it's there, and in the positive
interpretation of ambiguity where all answers reside.






More information about the Python-list mailing list