def __str__(self):
return "the command '{0}' is unknown".format(self.msg)
## The command object will use a "line source" object which
## should expose (at least) the context protocol
## (http://docs.python.org/2/library/stdtypes.html#context-manager-types)
## and the iterator protocol
## (http://docs.python.org/2/library/stdtypes.html#iterator-types)
##
## The ".run( <linesource> )" method uses the line source object
## as:
## self.run( <linesource> ):
## with <linesource> as tmp:
## for line in tmp:
## execute( line )
##
## This allows the linesource object to create a context which
## will be automagically destroyed when the ".run()" is finished.
##
## The "readkbd" line source class uses this context to save &
## restore the current history [== Python interactive shell's history]
## and to restore and save the history of the command line environment,
## the application's interactive shell.
##
## This way the two histories remain nicely separated/unpolluted
## This is the base class implementing a push/pop of current history
## and push/pop of (temporary) alternative history. Classes which
## want their own readline history saved can derive from this one.
评论列表
文章目录