Typed python comparison / code analysis questions
lucasvickers at gmail.com
Wed Jan 4 15:09:51 EST 2012
I'm relatively new to Python. I come from C/C++ so I love the flexibility
but I am slightly irked by the lack of compilation time checking.
I've got two questions
1) Are there any tools that do an analysis of code and attempt to catch
potential issues such as undefined variables, etc? I use xdebug in php for
this purpose and it's a life saver. Currently for Python I use module test
cases and simulate situations but this doesn't catch everything and on a
larger scale of development becomes difficult.
2) Is there a way to error when comparing variables of different types? I
was up late last night coding and caused a few bugs with the below code,
which turns out to compare a type<str> to a type<int>. I know good
programming I should know what my variable types are, but it would be even
better if I could always abide by a rule of using <_ (or something) which
would spit an exception when comparing non-equal types/instances.
rows = pamss.conn.fetchRows(results)
count = rows['cases'] // should be int(rows['cases'])
return count < MAX_CONCURRENT_IVR
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list