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.
Written by Alexander Brevig
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#