Don't confuse Jython or CPython with a shell script like Bash or anything like that. In order to do what you are asking, you might need to make an object wrapper for it, and then you can set up (I believe) a way of overriding the equals/assignment operator.

Now, with Jython, it can use JavaBean properties like they are class variables, what I mean is something like:

motor4.getPosition() or motor4.setPosition() can be rewritten as motor4.position.

So you can, instead of motor4.setPosition(3), just write motor4.position = 3 and get the same thing.

On Wed, Aug 5, 2009 at 11:32 PM, william ratcliff <william.ratcliff@gmail.com> wrote:
Recently, the development team has given us a jython (using jyconsole, perhaps we should switch to jythonconsole?) environment within the client to develop our own commands.  Sadly, we have no jython experts in house.  Here is my question:

I can currently do commands like
>>MoveMotor(motor position)

within the console.  However, for our users, I would think something like:
>>mv motor4=3
or even:
>>mv motor4 3

would be more intuitive.

So, here is my question:
is there any easy way to alias commands in the python interpreter?  Or, do I need to 
catch the string before it goes to the interpreter and parse the string, strip the arguments  and call my function with them first?  Within cpython (or jython if anyone knows), where can I get a hook into the string before an exec() is run?  Also, are modules such as optparse, argparse, cmd2, cmdline, etc. limited to only sys.argv, or can they be used on any string (or I guess list)?

Thanks,
William

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jython-users mailing list
Jython-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users




--
"I'm not responcabel fer my computer's spleling errnors" - Xlorep DarkHelm
Website: http://darkhelm.org
Sent from Santa Maria, CA, United States