Python vs. Io

David M. Cooke cookedm+news at physics.mcmaster.ca
Thu Jan 29 17:21:19 EST 2004


At some point, LittleDanEhren at yahoo.com (Daniel Ehrenberg) wrote:

> Io (www.iolanguage.com) is a new programming language that's purely
> object-oriented (but with prototypes), has a powerful concurrency
> mechanism via actors, and uses an extremely  flexible syntax because
> all code is a modifiable message tree. Like Python, it is dynamically
> typed, has a very clean syntax, produces short code, and is
> excruciatingly slow (on the same level as eachother). Io has a unique
> syntax combining Lisp's idea of functions for flow control with
> traditional function syntax and smalltalk-like syntax to get slots of
> objects. Io has no keywords and everything, even multiple lines of
> code, can be used as an expression. Even as a beginner to Io, I was
> able to write something in just 43 lines to let you do something like
> this (and more) in Io:
>
> each((key, value) in map(x=1, y=2, z=3),
>     write(key, ": ", value, "\n")
> )
>
> Neither the each function nor the map function were built in (Io has
> other mechanisms for that kind of thing, but they are less efficient).
> Can anyone show me how to so much as alias "for" to "each" in Python
> or allow block syntax at all without hacking the C source code?

Hey, if I wanted to to, I could add functions and all that that would
make Python look like Lisp, or IO, or whatever.

But, why? If I wanted to write Lisp or Io, I'd use those.

Your example I'd write in Python as

for key, value in dict(x=1, y=2, z=3):
    print '%s: %s\n" % (key, value)

I didn't have to write 43 lines of support code, and it's also two
lines. I don't think "this isn't builtin" is a selling point -- you
need a critical mass of builtins to make a language useful.

> Io doesn't use __methods_with_this_annoying_syntax__ because nothing
> is supposed to be for internal use only and there are only about three
> functions that would cause a problem if overridden.

> For embedding, Io doesn't have to use Py_ALL_CAPS, instead it just
> uses IoCamelCase, which looks much better. Interfaces to C are much
> more object oriented.

Ok, these two points are window-dressing: minor spelling and
punctuation issues (which seems to be what most language wars are about).

Heck, use boost::python for C++ interfaces; those function names are
even shorter. Or use pyrex to generate wrappers, writing them in a
Pythonesque language.

> Many users of Io (myself included) have switched over from Python for
> these reasons.
>
> I guess there are still the obvious advantages of Python over Io,
> including
> *large community
> *more bindings to stuff

Yep. That's a *big* difference, I'd say.

> *strict coding conventions
> *inflexible so everything is the same

Can you elaborate a bit on why Python is inflexible? I find Python to
be extremely flexible.

> *no need to close blocks
> But unless there are other problems, the first two go away soon
> (considering that Io was first created just two years ago). The last
> three are somewhat trivial and may even be to Io's advantage.

Python is 14 years old, and it's still working on global domination;
Io's got some catching up to do :-)

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca



More information about the Python-list mailing list