Last active
May 21, 2016 06:48
-
-
Save lopezpdvn/9a89dad82db384021c5e to your computer and use it in GitHub Desktop.
python_tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding=utf-8 | |
'''Module docstrings title. | |
Don't use keywords only arguments (for functions), sphinx.ext.autodoc will | |
fail if you do. | |
When in doubt consult [PEP8]_. | |
Citations | |
========= | |
.. [PEP8] http://www.python.org/dev/peps/pep-0008/. | |
''' | |
# Standard library imports. | |
from __future__ import division | |
from pprint import pprint | |
import sys | |
import os | |
import atexit | |
import gc | |
# Related third party imports. | |
# import third_party_mod | |
# Local application/library specific imports. | |
# import app_specific_mod | |
# Relevant ``__all__`` specification here. | |
# __all__ = ... | |
# GLOBAL CONSTANT names. *if main* section at bottom sets global names too. | |
def on_exit(): | |
'''Actions to do on exit.''' | |
print('on_exit', LOGF) | |
# Invoke the garbage collector. | |
gc.collect() | |
def main(): | |
'''Main program function.''' | |
pass | |
if __name__ == "__main__": | |
# Program name from file name. | |
PN = os.path.splitext(sys.argv[0])[0] | |
# Log file. | |
LOGF = ''.join([PN, '_log', '.txt']) | |
atexit.register(on_exit) | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment