Package wx :: Package py :: Module pseudo :: Class PseudoKeyword
[frames | no frames]

Class PseudoKeyword


A callable class that calls a method passed as a parameter.

Good for creating a pseudo keyword in the python runtime environment. The keyword is really an object that has a repr() that calls itself which calls the method that was passed in the init of the object. All this just to avoid having to type in the closing parens on a method. So, for example:

>>> quit = PseudoKeyword(SomeObject.someMethod)
>>> quit

SomeObject.someMethod gets executed as if it had been called directly and the user didn't have to type the parens, like 'quit()'. This technique is most applicable for pseudo keywords like quit, exit and help.

If SomeObject.someMethod can take parameters, they can still be passed by using the keyword in the traditional way with parens.


Method Summary
  __init__(self, method)
Create a callable object that executes method when called.
  __call__(self, *args, **kwds)
  __repr__(self)

Method Details

__init__(self, method)
(Constructor)

Create a callable object that executes method when called.


Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:08:47 2007 http://epydoc.sf.net