[Tutor] quick question to open(filename, 'r') vs. file(filename, 'r')
Emile van Sebille
emile at fenx.com
Tue May 5 00:59:49 CEST 2009
On 5/4/2009 2:50 PM bob gailer said...
> PDavid wrote:
>> Dear list,
>>
>> in different books I come across different syntax for dealing with
>> files. It seems that open(filename, 'r') and file(filename, 'r') are
>> used interchangeably, and I wonder what this is all about. Is there a
>> reason why Python allows such ambiguity here?
Backwards compatibility. The file type was introduced in python 2.2,
before which there was open.
Emile
More information about the Tutor
mailing list