I want to start by thanking everyone for their quick responses.
Keyword args are an excellent suggestion! Assuming that funcutils is in jython 2.5, then we can get around having to explicitly define every motor.
Now, for the problem that I am trying to solve:
We are a rather large facility where users come to perform experiments. We had an ancient piece of software (started on the VAX) used to drive the instrument, but it cannot handle our new instruments. Some years back, the control software was rewritten using a client server model. The server is in python and lives on a linux box. The client is in java. Part of this was a cross platform issue (we have people who may need to drive the instruments using macs, linux, or windows). Part of it was a question of expertise and ability to find programmers. Now, there is a command set implemented in Java that is then communicated to the server.
Now, we would like to allow the users (scientists) to be able to have a scripting environment to perform experiments. Since there is already a client written in Java, jython would be a natural choice for a scripting language. However, as functionality is added by "power/expert" users in the form of jython modules, we would like to be able to port that functionality back to "regular" users.
The command syntax of both the current and previous software have been of the form:
"move motor4 10"
so, while in jython for our "power users", they would be able to do something like
move(motor4=10), I would like to avoid requiring regular users to learn python, but rather to just give them back commands with similar syntax to what they are used to. So, it sounds like I should either investigate whether ipython and jython play well together or look into the cmd module.
On Thu, Aug 6, 2009 at 11:09 AM, Marc Downie<firstname.lastname@example.org> wrote:
> But this is Python — you'd define __getattr__ and __setattr__ methods to letAnother alternative, using **kwargs:
> you write:
> That has the same number of characters as mv SampleSlit 30.
But I'm not getting what's the idea here. If having the
"spaced-arguments syntax" is a hard requirement, I'd like to know what
are the other pieces of the problem (e.g.: why are you trying to solve
this using Python/Jython?) to be able to give better answers.
Leo Soto M.