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

am a newbie but i have a question here. You wanted State to behave like an interface right and throw an error when run() and next() are not defined, then assert should be

assert 0, "run not implemented"

??

Email the commenter f  e  x


The correct exception to raise for a method that is not implemented by class is NotImplementedError, so this would become:


class State:
    def run(self):
        raise NotImplementedError('State.run')
    def next(self):
        raise NotImplementedError('State.next')
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.