DO NOT USE file() (was Re: altering an object as you iterate over it?)
Tim Peters
tim.peters at gmail.com
Sat May 20 00:52:23 EDT 2006
[Tim Peters]
>> In 2.5 `file` is unchanged but `open` becomes a function:
>>
>> >>> file
>> <type 'file'>
>> >>> open
>> <built-in function open>
[Paul Rubin]
> So which one are we supposed to use?
Use for what? If you're trying to check an object's type, use the
type; if you're trying to open a file, use the function.
>>> type(open('a.file', 'wb')) is file
True
More information about the Python-list
mailing list