Untitled
unknown
python
4 years ago
308 B
9
Indexable
from some_decorators import run
""" Running 'main' function in the script when running with __name__ == '__main__' """
""" Traditional way """
def main():
print('Some action...')
if __name__ == '__main__':
main()
""" Decorator way """
@run
def main():
print('Some action...')Editor is loading...