I have an interface-like function implemented this way:
# File: parsers.py
class BaseParser(object):
'''Interface class'''
def __init__(self):
self.content
def Parse(self):
"""The interface, not implemented"""
raise NotImplementedError('{}.Parse()'.format(inspect.stack()[0][3]))
class SimpleParser(BaseParser):
'''Implementation class'''
def __init__(self):
BaseParser.__init__(self)
def Parse(self):
# Do real work
Now when I import this module, I get NotImplementedError right away so I can't use SimpleParser. How could I use this exception idiom and still be able to use it?
Thanks!