はいの場合、以下よりも良い方法を提案できますか?詳細/正当化してください。
class X:
...
if __name__ == '__main__':
# TODO: Should we bother doing this?
errorMessage = 'This class is not meant to have a main method. Do not execute directly.'
print(errorMessage)
raise Error(errorMessage)