Gabriel Genellina <[EMAIL PROTECTED]> wrote: > In > the example above, you can validate that fileobject has a write > attribute: getattr(fileobject, "write"). But I'd only do that if I > have a good reason (perhaps if the file is used after some lengthy > calculation,and I want to be sure that I will be able to store the > result)
Or even just: write = fileobject.write data = ... lengthy calculation here ... write(data) There is no point using getattr when you know the name of the attribute in advance. -- http://mail.python.org/mailman/listinfo/python-list