file **file**(filename[, mode[, bufsize]]) The type used for file objects (see [[type-file]]). The [[file]] constructor is new in Python 2.2 and is an alias for [[open]]. Both spellings are equivalent. The intent is for [[open]] to continue to be preferred for use as a factory function which returns a new file object. The spelling, file is more suited to type testing (for example, writing "isinstance(f, file)").