Creating a new file object; open() vs file()

Fredrik Lundh fredrik at
Sat May 20 09:25:45 CEST 2006

Ben Finney wrote:

>> I see what you mean, but I think that's why I like using open,
>> because I like having my functions be verbs instead of nouns.
> Note though that you're calling a class (in this case, type)
> constructor, to return a new object.

no, he's calling a factory function to get an object that provides the 
expected behaviour.

in future versions of Python, open() may not always create an instance 
of the file type.


More information about the Python-list mailing list