2.2 open

Tim Peters tim.one at comcast.net
Sun Mar 24 18:53:41 EST 2002


[Martin v. Loewis]
> Correction: open is file. Just try it
>
> >>> open is file
> 1
>
> So open is the type of file objects.

Na, file is the type of file objects:

>>> type(sys.stdout)
<type 'file'>
>>> type(sys.stdout).__name__
'file'

"open" was made identical to "file" just so open(filename) would continue to
work as before.  Once you get used to it, it's more natural to say
file(filename) in 2.2 (for much the same reason it's long been more natural
to say int("42") than string.atoi("42")).





More information about the Python-list mailing list