From e2d48882aaaba6ca554c18d22fa7068281cce1d0 Mon Sep 17 00:00:00 2001 From: DomHudson <10864294+DomHudson@users.noreply.github.com> Date: Sun, 19 Sep 2021 13:16:53 +0100 Subject: [PATCH 1/3] Add discussion point --- 2021/todo-abc.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/2021/todo-abc.md b/2021/todo-abc.md index 145122f..27d88c3 100644 --- a/2021/todo-abc.md +++ b/2021/todo-abc.md @@ -122,7 +122,10 @@ I concur. In the end, you're probably not even going to need that abstract base ## Discussion -No comments. Want to make a comment? Edit this page. Then submit a pull request. +> I would argue that it's odd to publish code with an unfinished implementation at all. Why add the methods if you won't implement them yet? +> However, if you really want to do this - why not just use the `NotImplementedError`? From [python's docs](https://docs.python.org/3/library/exceptions.html#NotImplementedError): abstract methods should raise this exception when they require derived classes to override the method, or while the class is being developed to indicate that the real implementation still needs to be added. +> It feels quite wacky to deliberately cause a syntax error when an exception also terminates the code, can contain additional context, and is used elsewhere. This approach even allows you to catch the error with a readable `except NotImplementedError:` statement. +> \- DomHudson From 1219076483fea040422eaa963daf1ddfb9430cd4 Mon Sep 17 00:00:00 2001 From: DomHudson <10864294+DomHudson@users.noreply.github.com> Date: Sun, 19 Sep 2021 13:18:54 +0100 Subject: [PATCH 2/3] Adding comment instructions back in --- 2021/todo-abc.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/2021/todo-abc.md b/2021/todo-abc.md index 27d88c3..a2b6885 100644 --- a/2021/todo-abc.md +++ b/2021/todo-abc.md @@ -127,10 +127,7 @@ I concur. In the end, you're probably not even going to need that abstract base > It feels quite wacky to deliberately cause a syntax error when an exception also terminates the code, can contain additional context, and is used elsewhere. This approach even allows you to catch the error with a readable `except NotImplementedError:` statement. > \- DomHudson - - - - + Want to make a comment? Edit this page. Then submit a pull request. From 73c00ae5fef0900cd861d2e1e459b6b68ea58030 Mon Sep 17 00:00:00 2001 From: DomHudson <10864294+DomHudson@users.noreply.github.com> Date: Sun, 19 Sep 2021 13:20:09 +0100 Subject: [PATCH 3/3] Making formatting more readable --- 2021/todo-abc.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/2021/todo-abc.md b/2021/todo-abc.md index a2b6885..2c46bab 100644 --- a/2021/todo-abc.md +++ b/2021/todo-abc.md @@ -123,8 +123,11 @@ I concur. In the end, you're probably not even going to need that abstract base ## Discussion > I would argue that it's odd to publish code with an unfinished implementation at all. Why add the methods if you won't implement them yet? +> > However, if you really want to do this - why not just use the `NotImplementedError`? From [python's docs](https://docs.python.org/3/library/exceptions.html#NotImplementedError): abstract methods should raise this exception when they require derived classes to override the method, or while the class is being developed to indicate that the real implementation still needs to be added. +> > It feels quite wacky to deliberately cause a syntax error when an exception also terminates the code, can contain additional context, and is used elsewhere. This approach even allows you to catch the error with a readable `except NotImplementedError:` statement. +> > \- DomHudson Want to make a comment? Edit this page. Then submit a pull request.