annoying behavior

Michael Hoffman at
Wed Sep 29 08:42:42 CEST 2004

Elbert Lev wrote:
> Michael Hoffman < at> wrote in message news:<cjcqao$ji0$1 at>...
>>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\
>   Caught exception importing module test:
>     File "C:\Python23\Lib\site-packages\pychecker\", line
> 576, in setupMainCode()
>       module = imp.load_module(self.moduleName, file, filename, smt)
>     File "", line 16
>       f = foo("1234")
>     File "", line 5, in __init__()
>       self.f()
>     File "", line 9, in f()
>       if self.r:
>   AttributeError: foo instance has no attribute 'r'
> Warnings...
>>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 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