How to avoid "f.close" (no parens) bug?

D H x at y.z
Sun Nov 13 17:27:25 CET 2005

Carsten Haese wrote:
> On Thu, 2 Nov 2006 23:56:22 +0200, o wrote 
>>plez send me 
> Please tell us what bug you're talking about:
> A) Python closed the file but you expected it not to.
> B) Python didn't close the file but you expected it to.
> C) Python didn't warn you when you wrote "f.close" instead of "f.close()".
> D) Something else. Please elaborate by giving us a code example, a description
> of what you expected to happen, and a description of what happened instead.

It is certainly B & C.  It is a common issue.  There is no way to avoid 
it unless you learn how to avoid it.  Other than that, PyChecker may 
help find this kind of error.  Over a year ago Guido said he wanted to 
include pychecker with python but it still hasn't happened, so you can 
download it from here:

More information about the Python-list mailing list