I wanted to use overloaded version of _get_all()
in _get_all_odd()
, is there a way to do it?
Calling it as BaseClass._get_all()
raises an exception "Must be overloaded"
,
calling it _get_all()
gives a not recognised
error.
########################################################################
class BaseClass:
@staticmethod
def _get_all():
raise Exception("Must be overloaded")
@staticmethod
def _get_all_odd():
result = [sh for sh in BaseClass._get_all() if sh%2 == 1]
return result
##################################################################
class Shape(BaseClass):
__all_shapes = [1, 2, 3]
@staticmethod
def _get_all():
return Shape.__all_shapes
print(Shape._get_all_odd())