Tuesday, June 27, 2006


Over the last two days I've been playing with HTTP POST and the xmlhttprequest object and teaching myself the HTML DOM (basically the stuff underneath AJAX, although without the AX). Crunchy now only uses HTTP GET for loading new pages and the graphics canvas (which will change as soon as I've tidied up what I've done already)

The speed improvements feel incredible  - pages no longer even pause when running most simple code.

Another change I've made is stopping code executing in temporary files, sadly I can't see how to do doctests without writing to a temporary file because we need a module to run doctest in and as far as I know, module objects are only created when a file is read.

Another welcome side effect of these changes is that it will be almost trivial to add in support for custom error reporting, we just have to subclass code.InteractiveInterpreter - isn't Python beautiful?!

I'll be posting a request for comments on simplified error reporting on the edu-sig mailing list in a couple of days once I've come up with some decent ideas.

In other news, I'm starting to doubt the viability of teaching programming to 7 year old's without recourse to an adult on hand all the time - but on the other hand Crunchy is becoming a viable platform even for more advanced students (Andrew Harrington from Loyola University seems very interested in it). I will continue to endeavour to come up with ways of making this easy enough for kids <10 years old, but I feel it would be more constructive to concentrate on an age group of >10. A tutorial that a 10 year old can understand without adult guidance should be possible for a 7 year old with an adult!


Marius Gedminas said...

I am pretty sure that if you study the doctest module (e.g. the DocFileTest function), you'll find a way to do doctests without temporary files.

johnSap said...

Here's a script for importing modules/packages over the net: http://urlimport.codeshift.net/
Maybe this is not directly applicable, but it should show how to import code from anywhere as a module.