Return to Home Page
      Blog     Consulting     Seminars     Calendar     Books     CD-ROMS     Newsletter     About     FAQ      Search
 

Perhaps by defining in the State class a function:


class State:
  def setTransitions(self, transitions):
    # Lazy initialization:
    if not self.transitions:
      self.transitions = transitions

Then the repeated code can be shortened to:

def next(self, input):
    return self.setTransitions(input, { 
      MouseAction.removed : MouseTrap.waiting,
    }
    return StateT.next(self, input)
f  e  x



Add your comment below. Use an empty line between each paragraph. Paragraphs will be automatically formatted, and single carriage returns will be respected. Use <code> to begin a code block, and </code> to end a code block. Your email address will not be visible to spam harvesters or used in any way except to contact you with further questions.

Your Email Address:

Search     Home     WebLog     Consulting     Seminars     Calendar     Books     CD-ROMS     Newsletter     About     Contact     Site Design     Server Maintenance     Powered by Zope
©2007 MindView, Inc.