IoPython, raw but cool

I nosed around in Io’s “addons” folder, which you also can pull from the Git repository, see the Io homepage.

Update: of course, this was reported when it was fresh, with nice examples, too: pinupgeek’s blog is full of Io goodness. (Thanks, trevor!)

While nosing, I met the Python module, which lets you run Python functions in Io. It was written last year, the copyright statement shows:

  docCopyright("Aslak Gronflaten", 2006)

IoPython lacks tests, real documentation, and such, and it does not do memory management:

* Convert an Io object to PyObject.
* At the moment, we can't pass in any objects, just those that can be translated,
* until I build a python wrapper around an io object, reverse of what I did here.
* TODO: Memory management!!!

Does not seem impossible.

But I get a nice vibe from these lines:


  # Import a module
  sys := Python import("sys")

  "Which version of python are we running?" println
  sys version println

  "System path is returned as a list" println
  sys path foreach(p, p println)

  "Load the string module" println
  string := Python import("string")

  "Split a string" println
  str := "Brave brave Sir Robin"
  str println
  string split(str) println

  "Load a C module (.so)" println
  t := Python import("time")

  writeln("Current time is: ", t time)

  "Another way to invoke a method" println
  str = "UPPERlower"
  write(str, " --> ")
  string invoke("swapcase", str) println

Io could improve its library situation, if IoPython were less raw. Things will improve with time. In the meantime, I’m gonna learn more Io.