How to avoid "f.close" (no parens) bug?
steve at ferg.org
Wed Feb 11 16:01:13 CET 2004
I've just spent several very frustrating hours tracking down a bug in
one of my programs. The problem was that I was writing text to a
file, and when I was done I coded
when I should have been coding
with the parentheses.
Although I love Python dearly, the fact that such an easy-to-make
mistake should do nothing useful and do it silently (which, in this
context, means: fail silently) seems to me a bit of a wart.
In any event, does anybody have any suggestions for how a coder could
avoid making such a mistake, or detect it quickly?
I teach the occasional beginning Python class, and I would hate to
have to tell my beginning students to watch out for making this kind
of mistake because it can bite you in a most nasty way.
More information about the Python-list