Some python comments/questions

Bill Janssen (janssen@parc.xerox.com)
Mon, 11 Oct 1993 16:19:20 PDT

I'm happier with python than with any scripting/extension language
I've ever tried... but I have a few comments/questions:

1) I'm addicted to the C syntax of ?:, as in

foo ((a < b) ? c : d);

Is there some equivalent in python?

2) It would often be useful if there was some way to create function
objects without binding them to some name. You can do it with
something like

def makefuncobj ():
def tmp (x, y, z):
return (x + y * z)
return(tmp)

a = makefuncobj()

but you need to define a new makefuncobj for every function you
wish to dynamically create, which takes some of the dynamism
out of it :-). I'd like to be able to have some expression whihc
evaluates to a function object without binding any names, perhaps
something like

a = def *(x, y, z):
return x + y * z;

You could almost do it with exec(), I'd think, except that exec()
doesn't return its value. Are multi-line expressions even allowed?

3) Are exceptions implemented in such a way as to be thread-safe?
You speak in the EXTENDING document of a global variable that is
bound...

4) I'd like to extend python to speak ILU, the distributed interface
system we're developing here. My thought is to add the ILU parser
and runtime kernel to the interpreter core, and then use it thusly:

A new call, ilu.load(<interface-file-name>), will use the ILU parser
to read and parse the file describing one or more interfaces; the
parse tree will then be interpreted in C. In C, a new module will be
defined for every interface defined in the file; a new object type
will be defined for every object type defined in every interface; a
new method object will be generated for every method of every new
object type; every method will look something like

def m(self, *args)
return(ilu.call (self, <x>, args))

where <x> is a description of method m's signature. Note that there
will be no corresponding method in C for these newly defined methods.

OK, so defining new modules at the C level isn't hard. Event objects
aren't bad. But I don't see how to define new methods or function
objects without real C functions to bind them to.

5) It's too bad that development on STDWIN is discontinued. We use
both Macs and UNIX here, and having a portable UI interface is very
nice. Not to mention that python with Motif is 3 MB, without Motif
it's 1 MB.

Bill