parameters: ()
docstring: This is where the example starts and the FSM state transitions are
      defined. Note that states are strings (such as 'INIT'). This is not
      necessary, but it makes the example easier to read.
docstring_summary: This is where the example starts and the FSM state transitions are
      defined. Note that states are strings (such as 'INIT'). This is not
      necessary, but it makes the example easier to read.
docstring_tokens: This is where the example starts and the FSM state transitions are defined . Note that states are strings ( such as INIT ) . This is not necessary but it makes the example easier to read .
function: def main():
      """This is where the example starts and the FSM state transitions are
      defined. Note that states are strings (such as 'INIT'). This is not
      necessary, but it makes the example easier to read. """
  
      f = FSM('INIT', [])  # "memory" will be used as a stack.
      f.set_default_transition(Error, 'INIT')
      f.add_transition_any('INIT', None, 'INIT')
      f.add_transition('=', 'INIT', DoEqual, 'INIT')
      f.add_transition_list(
          string.digits,
          'INIT',
          BeginBuildNumber,
          'BUILDING_NUMBER')
      f.add_transition_list(
          string.digits,
          'BUILDING_NUMBER',
          BuildNumber,
          'BUILDING_NUMBER')
      f.add_transition_list(
          string.whitespace,
          'BUILDING_NUMBER',
          EndBuildNumber,
          'INIT')
      f.add_transition_list('+-*/', 'INIT', DoOperator, 'INIT')
  
      print
      print 'Enter an RPN Expression.'
      print 'Numbers may be integers. Operators are * / + -'
      print 'Use the = sign to evaluate and print the expression.'
      print 'For example: '
      print '    167 3 2 2 * * * 1 - ='
      inputstr = raw_input('> ')
      f.process_list(inputstr)
function_tokens: def main ( ) : f = FSM ( 'INIT' , [ ] ) # "memory" will be used as a stack. f . set_default_transition ( Error , 'INIT' ) f . add_transition_any ( 'INIT' , None , 'INIT' ) f . add_transition ( '=' , 'INIT' , DoEqual , 'INIT' ) f . add_transition_list ( string . digits , 'INIT' , BeginBuildNumber , 'BUILDING_NUMBER' ) f . add_transition_list ( string . digits , 'BUILDING_NUMBER' , BuildNumber , 'BUILDING_NUMBER' ) f . add_transition_list ( string . whitespace , 'BUILDING_NUMBER' , EndBuildNumber , 'INIT' ) f . add_transition_list ( '+-*/' , 'INIT' , DoOperator , 'INIT' ) print print 'Enter an RPN Expression.' print 'Numbers may be integers. Operators are * / + -' print 'Use the = sign to evaluate and print the expression.' print 'For example: ' print '    167 3 2 2 * * * 1 - =' inputstr = raw_input ( '> ' ) f . process_list ( inputstr )