Re: Scripting in Python

Guido.van.Rossum@cwi.nl
Tue, 21 Jun 1994 09:48:38 +0200

> In many scripting languages (ScriptX, TeleScript, HyperTalk) you can write
> something like -
>
> ON trigger DO
> Play the movie named "Guido"
> Goto Card name "Nice and Clean"
> END
>
> I am attempting to do something similar with media using Python but am
> finding that the language keeps forcing me to refer to the final names of
> objects. Can anyone point out a way for me to soft-code the Trigger events
> to get the ON event behavior? How about support for referring to objects by
> name as opposed to by symbol?

I'm afrain I don't understand what you want. I don't know hypertalk
enough to understand what the "... named ..." construct means. If it
just means searching through all objects for one with a given 'name'
attribute, surely you can do that in Python, if you maintain a
dictionary mapping names to objects. (Your object initialization
methods could probably be hacked to maintain that dictionary
automatically.) Since objects may not have top-level names (an object
can be contained deep in a data structure) searching through the
dictionary of a module (or even of all modules) won't necessarily find
all objects.

But maybe you can give a more elaborate example?

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
URL: <http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>