learnpython.org - an online interactive Python tutorial

Chris Angelico rosuav at gmail.com
Sat Apr 23 21:35:28 EDT 2011

On Sun, Apr 24, 2011 at 10:42 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> This is much like my experience with Apple's Hypertalk, where the only
> data structure is a string. I'm very fond of Hypertalk, but it is hardly
> designed with machine efficiency in mind. If you think Python is slow
> now, imagine how slow it would be if every expression had to be converted
> from a number back into a string, and vice versa, after every operation:
> x = str(int("1") + int("2"))
> y = str(int("9")/int("3"))
> z = str(int(x) - int(y))
> flag = str(int(z) == int("0"))
> only implicitly, by the interpreter.

Except that it wouldn't bother with a native integer implementation,
would it? With a string-is-bignum system, it could simply do the
arithmetic on the string itself, with no conversions at all.

Re harrismh's code: For that sort of work, I used and still use the
REXXTry program that comes with OS/2 (written, I believe, by Mike
Cowlishaw), with a modified input routine that gives readline-style
capabilities. Dragging this vaguely back on topic, the end result is
rather similar in feel to IDLE or Hilfe (Pike's interactive

Chris Angelico

More information about the Python-list mailing list