create new statement?

Bruce Edge bedge at troikanetworks.com
Fri Mar 2 16:10:28 EST 2001


Steve Purcell wrote:
> 
> 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.

I played around with that for a bit. I think it is useable. 
I would need to register an alternate completer for readline, as the
default
picks up the python global namespace.

Thanks.

> 
> -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