Help a C++ coder see the light

Alexander Schmolck a.schmolck at gmx.net
Thu Jan 30 14:33:16 EST 2003


mark.charsley at REMOVE_THIS.radioscape.com (Mark Charsley) writes:

> The more nasty problem is changing a function to have, say, an extra 
> argument. In C++ I'd just run the code through the compiler and it would 
> tell me all the places where the code needs updating. In python I'd have 
> to trust grep (and follow up all the cases where the function was assigned 
> a new name, passed to a callback interface etc. and/or where the arguments 
> are built somewhere else and just passed in via "apply").

Are you talking of this case?

   def aTest():
       print "HI"
   def bTest():
       return aTest(3)

pychecker seems to handle that fine:

  /home/hobbes3/aschmolc/py/test.py:4: Invalid arguments to (aTest), got 1, expected 0   

If you use a recent version of python-mode in emacs, you can do C-c C-w to run
pychcker like and jump to the offending files and lines by just clicking on
the error messages (I submitted a patch some time, which Barry has
incorporated -- it might still be only available from CVS, though).

Anyway, the right solution to this problem is not so much compile time
checking but a refactoring browser. If you don't want to switch to smalltalk,
try http://bicyclerepair.sourceforge.net/ for python, which however still is
alpha.


alex





More information about the Python-list mailing list