create new statement?

Steve Purcell stephen_purcell at yahoo.com
Fri Mar 2 14:13:00 EST 2001


Bruce Edge wrote:
> I want to add my own command to the interp, but not have to use object
> calling syntax
> eg:
>     create obj opt
> not
>     create(obj, opt)
> 
> How do I define new statements, or, a way of calling functions using the
> former syntax?

You can get the effect you want by subclassing 'Cmd' in the 'cmd'
standard library module and using your subclass in place of the usual
interactive command interpreter.

-Steve

-- 
Steve Purcell, Pythangelist
Get testing at http://pyunit.sourceforge.net/
Get servlets at http://pyserv.sourceforge.net/
"Even snakes are afraid of snakes." -- Steven Wright




More information about the Python-list mailing list