annoying behavior

Michael Hoffman m.h.3.9.1.without.dots.at.cam.ac.uk at example.com
Wed Sep 29 08:42:42 CEST 2004


Elbert Lev wrote:
> Michael Hoffman <m.h.3.9.1.without.dots.at.cam.ac.uk at example.com> wrote in message news:<cjcqao$ji0$1 at gemini.csx.cam.ac.uk>...
> 
>>Can you post the results of your PyChecker run and the exact input to it?
> 
> Here it is:
> 
> Processing test...
> C:\Python23\python.exe
> C:\Python23\Lib\site-packages\pychecker\checker.py
>  test.py
>   Caught exception importing module test:
>     File "C:\Python23\Lib\site-packages\pychecker\checker.py", line
> 576, in setupMainCode()
>       module = imp.load_module(self.moduleName, file, filename, smt)
>     File "test.py", line 16
>       f = foo("1234")
>     File "test.py", line 5, in __init__()
>       self.f()
>     File "test.py", line 9, in f()
>       if self.r:
>   AttributeError: foo instance has no attribute 'r'
> 
> Warnings...
> 
> test:1: NOT PROCESSED UNABLE TO IMPORT
 >
>>I think that what you want the Python compiler to do is harder than you 
>>think it is, and not all cases will be caught unless you actually run 
>>the program. 

If you noticed from the output, PyChecker is testing your testcase by 
actually *running the code.* If you just ran python test.py you would 
have found the error just as quickly. If you ran PyChecker on my 
testcase, or the original code that caused you problems (I'm guessing) 
you wouldn't have found it.

> Sure not all!

How would you propose an algorithm that will find the majority of these 
cases without running the code? I am claiming that this is nontrivial; 
you are claiming that it is not, so you should provide an indication of 
how this would be done.

> Isn't this what Python is about - fast and fun programming, not
> frustration.

Yeah, but sometimes it's impossible

> After all, if I want troubles, I always can use C or Java
> :))

Yeah, but Python is not a silver bullet.
-- 
Michael Hoffman



More information about the Python-list mailing list