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

Batista, Facundo FBatista at uniFON.com.ar
Wed Feb 11 14:36:08 EST 2004


Dave Kuhlman wrote:

#- Here is an example:
#- 
#-     def test():
#-         myobject = MyClass()
#-         clean = myobject.my_really_long_method_name
#-         clean(a)
#-         clean(b)
#-         clean(c)
#-         clean(d)
#-         o
#-         o
#-         o

Wrong. You don't have "myobject.my_really_long_method_name" alone, you have
an assignment here.


#- Another example:
#- 
#-     def test(meth):
#-         o
#-         o
#-         o
#-         meth(a)
#-         o
#-         o
#-         o
#- 
#-     myobject = MyClass()
#-     test(myobject.some_method)
#-     test(myobject.some_other_method)
#- 
#- In this example, we've used a method as a parameter.

But you're using it in a function call! It's not alone!

.	Facundo




More information about the Python-list mailing list