Best search algorithm to find condition within a range

Chris Angelico rosuav at
Wed Apr 8 03:46:27 CEST 2015

On Wed, Apr 8, 2015 at 8:51 AM, Steven D'Aprano
<steve+comp.lang.python at> wrote:
> There hasn't been a machine in common use that used other than binary for
> integers for probably forty years now, and there has *never* been a PC that
> has used other than binary for integers. When you write 12345 as an integer
> in a programming language, it is NOT stored internally as five decimal
> digits 1 2 3 4 5 in *nearly all languages*. There might be one or two
> exceptions, e.g. Hypertalk would store it as a string of bytes 0x3132333435
> in hexadecimal, or in binary 0011000100110010001100110011010000110101.
> (As you can guess, Hypertalk is not the most efficient of languages.)

FWIW, REXX does the same thing as Hypertalk - the integer 12345 and
the string "12345" are identical. If you add the string "1" and the
string "12345", you get the string "12346". (Concatenation is a
separate operation, and would result in the string "112345".) However,
Steven is still correct in that it is not stored as five decimal
digits; it's stored as five bytes in your system encoding. On my
systems, those were all ASCII-compatible, so it'd be 0x3132333435
(plus some metadata about string length and stuff, not germane to the
discussion), though I suspect that an EBCDIC system would store it as
0xF1F2F3F4F5 instead.


More information about the Python-list mailing list