How can I state that an abstract class variable must be defined with abcmeta
.
e.g.
class AbstractMover(metaclass=ABCMeta):
_destination_folder = NotImplementedError # how do I do something like this
@property
def destination_folder(self):
return self._destination_folder
and when it's inherited, it should raise an error if the _destination_folder
is not specified.
class ConcreteMover(AbstractMover): pass # should error
class ConcreteMover(AbstractMover):
_destination_folder = "path/to/folder" # works fine
This should then let me do
>>> ConcreteMover().destination_folder
path/to/folder
BUT It should raise an error if _destination_folder
is not defined in the concrete class.