command parsing and interpreter interaction

Chad Everett chat at linuxsupreme.homeip.net
Sat May 19 10:25:26 EDT 2001


On 18 May 2001 15:23:05 -0400, Alex <new_name at mit.edu> wrote:
>
>> I want to build a set of commands in the same way that the Cmd module
>> allows one to do, but I want all lines entered at the prompt that are
>> not defined by my interpreter to be handled by python as if it had
>> been entered at the python interactive interpreter prompt.
>
>Check out the pdb module, which does this.
>
>Alex.

I checked out the pdb module and it does have an alias command 
that appears from the code to dynamically define a cmd module
command. 

The trouble is you can't use pdb to interact with the python
interpreter in the same manner as when your at the interpreter.

For example, since pdb inherits from cmd and parses lines for
keyword that it matches to functions, you can't type something
like this at the pdb or cmd prompts:

def myfunc(num):
	print num

I guess I am really asking for the capability to have aliases at
the python interpreter prompt.






More information about the Python-list mailing list