title: Python inheritance: Raising an error when non-overridden methods are called
body: <p>I am writing a subclass of <code>dict</code> that maps from string keys to values of arbitrary types. If a key is a regex, it is stored and queried separately.</p>
  
  <pre><code>class RegexDict(dict):
      def __init__(self):
          super().__init__()  # non-regex keys in the parent class
          self.regex_dict = {}  # regex keys in the child class
  
      def __getitem__(self, key):
          try:
              return super().__getitem__(key)
          except KeyError:
              for x in self.regex_dict:
                  if re.fullmatch(x, key):
                      return self.regex_dict[x]
          raise KeyError(key)
  
      def __setitem__(self, key, value):
          key, is_regex = key
          if is_regex:
              self.regex_dict[key] = value
          else:
              super().__setitem__(key, value)
  </code></pre>
  
  <p>Because this class will be used by other libraries (which is why I have to use inheritance), I want to make sure that an error is raised when non-overridden methods in the base class are called. How should I do this?</p>