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

Peter Hansen peter at engcorp.com
Wed Feb 11 18:31:49 CET 2004


Skip Montanaro wrote:
> 
>     Facundo> #-     Warnings...
>     Facundo> #-
>     Facundo> #-     foo.py:4: Statement appears to have no effect
> 
>     Facundo> Why "appears"?
> 
> I think Neal was just being conservative when he wrote that.  In fact, today
> with properties and such, just the act of getting an attribute can have side
> effects.  Determining for sure that there were no side effects would
> probably require a lot more analysis, if it's even possible to determine
> without actually executing the code.

Or one might say he wrote that from the point of view of a code
reviewer experienced with Python.  Yes, the statement *appears* to
have no effect, and therefore if it really does have an effect it
is a surprising result, and certainly something PyChecker should
be pointing out in case it was in fact wrong.

-Peter



More information about the Python-list mailing list