
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
41 lines
1.0 KiB
Plaintext
41 lines
1.0 KiB
Plaintext
== Why is this an issue?
|
|
|
|
``++NotImplemented++`` is a constant which is intended to be used only by comparison methods such as ``++__lt__++``. Use it instead of ``++NotImplementedError++``, which is an exception, and callers will have a hard time using your code.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,python]
|
|
----
|
|
class MyClass:
|
|
def do_something(self):
|
|
raise NotImplemented("Haven't gotten this far yet.") #Noncompliant
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,python]
|
|
----
|
|
class MyClass:
|
|
def do_something(self):
|
|
raise NotImplementedError("Haven't gotten this far yet.")
|
|
----
|
|
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 28 Apr 2015, 10:04:00 Ann Campbell wrote:
|
|
http://mouadino.appspot.com/notimpelementederror-vs-notimplemented-in-python/
|
|
|
|
=== on 31 Jan 2020, 15:48:43 Nicolas Harraudeau wrote:
|
|
Closing in favor of RSPEC-5632.
|
|
|
|
``++NotImplemented++`` does not derive from BaseException so it will fail as any other non-exception.
|
|
|
|
endif::env-github,rspecator-view[]
|