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

Batista, Facundo FBatista at uniFON.com.ar
Wed Feb 11 11:33:40 EST 2004


Terry Reedy wrote:

#- > There is any case when f.close, or bar or something like 
#- "not a call to a
#- > function (there is no ')'), with no '=' at the left or at 
#- the right" has
#- any
#- > effect?
#- 
#- If the code is pasted into an interactive interpreter 
#- window, the bare
#- expressions get printed.

I'm ok with that, but is this really useful in a program?

The problem is that forgetting the "()" is a common mistake, and even if we
can not detect...

a = myclass.mymethod

...(when the user was meaning to execute it) because it's valid, I think
it'll be useful to detect and warning:

myclass.mymethod
mylist.sort
myfile.close

.	Facundo





. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
ADVERTENCIA  

La información contenida en este mensaje y cualquier archivo anexo al mismo,
son para uso exclusivo del destinatario y pueden contener información
confidencial o propietaria, cuya divulgación es sancionada por la ley. 

Si Ud. No es uno de los destinatarios consignados o la persona responsable
de hacer llegar este mensaje a los destinatarios consignados, no está
autorizado a divulgar, copiar, distribuir o retener información (o parte de
ella) contenida en este mensaje. Por favor notifíquenos respondiendo al
remitente, borre el mensaje original y borre las copias (impresas o grabadas
en cualquier medio magnético) que pueda haber realizado del mismo. 

Todas las opiniones contenidas en este mail son propias del autor del
mensaje y no necesariamente coinciden con las de Telefónica Comunicaciones
Personales S.A. o alguna empresa asociada. 

Los mensajes electrónicos pueden ser alterados, motivo por el cual
Telefónica Comunicaciones Personales S.A. no aceptará ninguna obligación
cualquiera sea el resultante de este mensaje. 

Muchas Gracias.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20040211/30acfd01/attachment.html>


More information about the Python-list mailing list