Type-Def-ing Python
Dear Python Community, I have been trying to research how to type-def python. I want to type-def python so that I can use it as a static analyzer to check for bugs. I have been going over research on this field and I came upon Brett Cannon's thesis in which he tweaks the compiler and shows that type-defing python would not help the compiler achieve a 5% performace increase. Brett Cannon, "Localized Type Inference of Atomic Types in Python": http://www.ocf.berkeley.edu/~bac/thesis.pdf I was wondering if anyone had his contact information so that I could might ask him for his source code and try to use type-defing as a bug-finder. With thanks, Brian -- http://mail.python.org/mailman/listinfo/python-list
Python "member of" function
Hi, I was wondering if anyone knew of a built in Python function that will check if an item is a member of a list, i.e., if item i is a member of list l. I read of a function "in" but I can't seem to get that to work and finding pages for "python in" does not reveal very many relevant sources. Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: Python "member of" function
Thanks, I was using "in" incorrectly. Thanks a lot! -- http://mail.python.org/mailman/listinfo/python-list
Obtaining the Python Control Flow Graph
Hi,
I have been looking for a good way to convert python code into a
control flow graph.
I know of Python functions that will convert an expression into an
abstract syntax tree (i.e. ast = parser.expr('(x+5)*5') then t =
ast.totuple() then t), but I am not sure how to obtain a CFG.
I've gone through the compiler and it has code that converts the AST
into a CFG (described here:
http://www.python.org/doc/peps/pep-0339/#ast-to-cfg-to-bytecode).
Basically, PyAST_Compile() in Python/compile.c coverts the AST to a CFG
and outputs final bytecode from the CFG by calling two functions:
PySymtable_Build() in Python/symtable.c and compiler_mod() in
Python/compile.c. PySymtable_Build() will build a symtable and
compiler_mod() will create the CFG.
PyPy also offers a way to obtain a control flow graph:
http://codespeak.net/pypy/dist/pypy/doc/objspace.html#the-flow-model
I was wondering if anyone had any advice on the best way to obtain a
control flow graph. I need the control flow graph because I am trying
figure out if there is a way to bound the integer ranges and list
lengths at compile time.
Thank you for your help
--
http://mail.python.org/mailman/listinfo/python-list
Future Warning with Negative Int
Hi, If I try to print a negative integer as a hexadecimal, I get the following error: FutureWarning: %u/%o/%x/%X of negative int will return a signed string in Python 2.4 and up For example: >>> print "%X" % -1 __main__:1: FutureWarning: %u/%o/%x/%X of negative int will return a signed string in Python 2.4 and up Does that mean that in the future it will say -1 or -? Also, how do I suppress this warning? Thanks, Brian -- http://mail.python.org/mailman/listinfo/python-list
