Sorta noob question - file vs. open?

Peter Hansen peter at engcorp.com
Wed Aug 24 17:39:11 EDT 2005


Peter A. Schott wrote:
> Thanks to all who replied.  If open is still preferred, I will 
 > stick with that.

FWIW, that's not an unqualified "preferred".  To demonstrate by example, 
neither of the above is considered preferred, though they both work:

   outputFile = file('path.to.file')

   if isinstance(outputFile, open): ...

whereas these _are_ preferred:

   outputFile = open('path.to.file')

   if isinstance(outputFile, file): ...

-Peter



More information about the Python-list mailing list