Python Not Implemented Error

In the documentation

exception NotImplementedError This exception is derived from RuntimeError. If you want a user-defined base class to require an abstract method to be overridden in a derived class, you must throw this exception.

is what it reads. For the time being, it seems that you should use it if you absolutely want to override.

# -*- coding: utf-8 -*-

class BaseTest(object):
    def hogehoge(self):
        raise NotImplementedError()


class Test(BaseTest):
    def hogehoge(self):
        print "hogehoge"


class Test2(BaseTest):
    pass


if __name__ == "__main__":
    test = Test()
    test.hogehoge()

    test2 = Test2()
    test2.hogehoge()

Output result

hogehoge
Traceback (most recent call last):
  File "test.py", line 22, in <module>
    test2.hogehoge()
  File "test.py", line 5, in hogehoge
    raise NotImplementedError()
NotImplementedError

Recommended Posts

Python Not Implemented Error
Python Error Handling
[Python] Name Error: name'urlparse' is not defined
Implemented SimRank in Python
Today's python error: killed
Implemented Matrix Factorization (python)
I implemented Python Logging
Python error list (Japanese)
Implemented Shiritori in Python
[Python] for statement error
Today's python error: HTTPError: 404 Client Error: Not Found for url:
Error: pg_config executable not found
filter rollbar python 404 not found
Implemented SMO with Python + NumPy
[Python] SQLAlchemy error avoidance memorandum
Python list is not a list
Python version does not switch
[youtube-dl] python3 SSL error (CERTIFICATE_VERIFY_FAILED)
Error when playing with python
#python Python Japanese syntax error avoidance
Sudoku solver implemented in Python 3
Slice error in python (´ ; ω ; `)
[Error] Symbol not found: _PyUnicodeUCS2_Compare
[Python] Not just count collections.Counter
6 Ball puzzle implemented in python
Error resolution python version check
[Python] Reason why index error does not occur in slice
Python error support note: "... does not support argument 0 of type float ..."
[python] Error when installing library ramkan
Today's python error: SyntaxError Non-ASCII character
Implemented image segmentation in python (Union-Find)
Error when building mac python environment
Python error: ModuleNotFoundError: No module named'flask'
Implemented file download with Python + Bottle
[Python] I implemented peripheral Gibbs sampling
Widrow-Hoff learning rules implemented in Python
Implemented label propagation method in Python
Use API not implemented in twython
A pretty sloppy Python error solution
Today's python error: image is blank
Python error detection run from Powershell
Implemented Perceptron learning rules in Python
Strange and horrifying Python error story
Implemented in 1 minute! LINE Notify in Python
Did not change from Python 2 to 3
python note: when easy_install is not available
Today's python error: ModuleNotFoundError: No module named
A simple HTTP client implemented in Python
dyld: Library not loaded: @ rpath / libopenblas.dylib error
Import error even though python is installed
Solution for pip install error [Python] [Mac]
[Python] [pandas] How is pd.DataFrame (). T implemented?
Today's python error: ModuleNotFoundError: No module named
Implemented in Python PRML Chapter 7 Nonlinear SVM
[Illegal hardware instruction python] error in PyMC3
[VScode] autopep8 format does not work [Python]
[Python] Understand the content of error messages
Virtualenv does not work on Python3.5 (Windows)
Python / dictionary> setdefault ()> Add if not in dictionary
I implemented Cousera's logistic regression in Python
windows7 / python3.3 / virtualenv / cx_Freeze / Import Error / MAXREPEAT