I use if __name__ == '__main__': ‘unnecessarily’ as a marker that the module is intended to be executed as a standalone script. While it may not strictly be required, it expresses this intent very clearly. I’m a -1 on adding another way to indicate this.
6 Likes
Even for standalone scripts it can be a good idea to use if __name__ = "__main__", e.g. when using doctest.
2 Likes