[Python] NotImplemented → NotImplementedError

From the Python documentation:
* NotImplemented: "Special value which can be returned by the 'rich comparison'
  special methods (__eq__(), __lt__(), and friends), to indicate that the
  comparison is not implemented with respect to the other type."
* NotImplementedError: "This exception is derived from RuntimeError. In user
  defined base classes, abstract methods should raise this exception when they
  require derived classes to override the method."
This commit is contained in:
practicalswift
2016-03-08 13:56:01 +01:00
parent bf8347457a
commit e8c0600727
2 changed files with 13 additions and 8 deletions

View File

@@ -15,19 +15,24 @@ class UnicodeProperty(object):
"""Abstract base class for Unicode properties."""
def __init__(self):
raise NotImplemented
raise NotImplementedError(
"UnicodeProperty.__init__ is not implemented.")
def get_default_value(self):
raise NotImplemented
raise NotImplementedError(
"UnicodeProperty.get_default_value is not implemented.")
def get_value(self, cp):
raise NotImplemented
raise NotImplementedError(
"UnicodeProperty.get_value is not implemented.")
def to_numeric_value(self, value):
raise NotImplemented
raise NotImplementedError(
"UnicodeProperty.to_numeric_value is not implemented.")
def get_numeric_value(self, cp):
raise NotImplemented
raise NotImplementedError(
"UnicodeProperty.get_numeric_value is not implemented.")
class GraphemeClusterBreakPropertyTable(UnicodeProperty):
"""Grapheme_Cluster_Break property."""