Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts
Wednesday, May 6, 2015
cscope for python: pycscope
cscope is very helpful when reading C source code. But it does not support python.
Luckily, I found pycscope can generate cscope files for python and it works very well.
Following are two links:
https://pypi.python.org/pypi/pycscope/
http://eli.thegreenplace.net/2010/09/28/pycscope-with-vim
Tuesday, November 1, 2011
Global variable in python
http://docs.python.org/faq/programming.html#what-are-the-rules-for-local-and-global-variables-in-python
http://stackoverflow.com/questions/423379/using-global-variables-in-a-function-other-than-the-one-that-created-them
In short, when modify the global variable in a function, need to explicitly define "global g_sth". This is to avoid using global variables.
Python tutorial and start up script
tutorial:
http://net.tutsplus.com/tutorials/python-tutorials/python-from-scratch-object-oriented-programming/
xml:
http://www.learningpython.com/2008/05/07/elegant-xml-parsing-using-the-elementtree-module/
http://net.tutsplus.com/tutorials/python-tutorials/python-from-scratch-object-oriented-programming/
xml:
http://www.learningpython.com/2008/05/07/elegant-xml-parsing-using-the-elementtree-module/
start up script:
from optparse import OptionParser
import sys
def main():
usage = "usage: %prog [options] arg"
parser = OptionParser(usage)
parser.add_option('-d', '--directory',
action='store', dest='directory',
default=None, help='specify directory')
parser.add_option('-f', '--file',
action='store', dest='filename',
default=None, help='specify file')
parser.add_option('-v', '--version',
action="store_true", dest="show_version",
default=False, help='displays the version number')
if len(sys.argv) == 1:
parser.print_help()
sys.exit()
(options, args) = parser.parse_args()
# rest of program...
if __name__ == '__main__':
main()
Wednesday, April 8, 2009
Sunday, April 5, 2009
Generate call graph for Python
Subscribe to:
Posts (Atom)