Last Updated: February 25, 2016
·
990
· alexanderbrevig

Make your Python code module safe

Here is a boiler-plate that I use with Python: https://gist.github.com/3810617

This enables 'clients' of your code to include your script/module without executing it.

If you use Sublime Text 2 I recommend the Gist package, which enable you to pull gists with ease. Version controlled snippets are awesome!

#!/usr/bin/python

import sys

def main():
    print 'Hello there', sys.argv[1]

if __name__ == '__main__':
    main()

I think I found it on google somewhere.