cannot write to file after close()

Reinhold Birkenfeld reinhold-birkenfeld-nospam at wolke7.net
Mon Sep 26 03:07:03 EDT 2005


Rainer Hubovsky wrote:
> Thank you Reinhold, that was the solution. But just because I am curious:
> what is this statement without the parentheses? After all it is a valid
> statement...
> 
>   Rainer
> 
> 
> In article <3pog58Fas5ndU2 at individual.net>, Reinhold Birkenfeld wrote:
>> Is the above exactly your code? If yes, it should be
>> 
>> f.close()
>> 
>> The parentheses are necessary to make the statement a function call.

In addition to what Fredrik said, this can be useful for shortcutting a name,
such as

c = f.close
c()

Reinhold



More information about the Python-list mailing list