[issue9648] 2to3 doesn't convert "file" usage to an "open" equivalent

Brian Curtin report at bugs.python.org
Fri Aug 20 03:59:37 CEST 2010


New submission from Brian Curtin <curtin at acm.org>:

"""
with file("sample.py", "r") as f:
    pass
"""

The above code comes out of 2to3 with no modifications suggested. "file" is gone in 3.x and could be substituted with "open" usage in most cases. We would also have to handle or otherwise notify the user about code like "isinstance(x, file)".

----------
messages: 114417
nosy: brian.curtin
priority: normal
severity: normal
stage: needs patch
status: open
title: 2to3 doesn't convert "file" usage to an "open" equivalent
type: behavior
versions: Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9648>
_______________________________________


More information about the Python-bugs-list mailing list