[Edu-sig] re-doing GvR in xturtle

Andre Roberge andre.roberge at gmail.com
Mon Aug 14 03:34:18 CEST 2006


On 8/13/06, kirby urner <kirby.urner at gmail.com> wrote:
> > The soon-to-be-released-next-version will have quite a few sample
> > tutorials as well as documentation that includes all kinds of examples
> > that can be cut-and-pasted.   We're mostly adding the final touches to
> > a "security module" before we proceed with the next release (hopefully
> > this week).
> >
> > André
>
>
> Thanks André, you answered my question about what teachers would pass
> around, assuming Crunchy Frog installed / working.
>
> Tried in Python 2.5 but even after changing to xlm.etree, could find
> HTMLTreeBuilder, so ended up with separate ElementTree installation.

I was hoping that this was not going to be necessary with Python 2.5
(I'm still using 2.4 myself)... It's too bad that ElementTree will
still be required as a separate download.

>
> It'd be nice if a VLAM evaluation would then give an ensuing Python
> interpreter access to the namespace created thereby, something like
> i.e. if I define a class and user Evaluates, then user might create
> objects of that class in the following line-by-line dialog.
>
> Or is that capability already somehow present and I've missed seeing it?
>
No, you did not miss it.  "Evaluate" is used, among others, with an
"editor" (html textarea).  Upon clicking on the Evaluate button, the
code is executed within its own local dict, to avoid possible
interference with Crunchy's own code.

The Python interpreter is also working with its own namespace.  I
think it might be potentially really confusing (for students, not so
for teachers like you) if all the code used within a single session
was somehow all put in the same namespace.  However....

One thing we are working on is the ability to save a file (from an
"editor").  Then, it will be possible to import that file from the
interpreter and proceed from there.  So, one could start with a sample
lesson containing some pre-defined class that could be executed ...
and/or saved into a file.  It could then either be further edited
(within the "editor") or imported at an embedded prompt and "played"
with from there - a bit like you could do with Idle I guess.

One possibility not available with Idle is if you plan a lesson that
way, you can "cut and paste" your interractive practice session right
into a web page (you might need to put in the fake interpreter
prompt), and use it both as a guide when doing a demo, and as a
reference for the students.  The "soon to be released version" will,
if desired, take a "fake interpreter session", extract the input from
the user and put the Python code (minus the interpreter prompt and the
output, but keeping the indentation intact) into an "editor" so that
it can be run all at once, without having to retype everything - and
the output of the live session can be compared with  the one
"recorded" on the html page.
For example, putting the following inside an html page (with the
appropriate vlam code)
==============
>>> def p3():
...     print 3
...
>>> p3()
3
========
will insert the following inside an "editor" box:
====
def p3():
    print 3

p3()
====
Ready to be further edited or evaluated as is.  Or, if you prefer, you
can simply have an interpreter prompt inserted right underneath the
"fake interpreter session", which you can then reproduce.

Thanks for trying it!
André

> Kirby
>


More information about the Edu-sig mailing list