[Python-porting] porting builtin file type to python3
Bernhard Leiner
mailinglists.bleiner at gmail.com
Tue Jan 20 00:50:43 CET 2009
Hi,
I have a custom file type that looks more or less like this:
class myfile(file):
def __init__(self, name, mode):
super(myfile, self).__init__(name, mode)
self.write('file header...\n')
And I'm pretty sure that porting this class to python3 will result in
something like:
import io
class myfile(io.FileIO):
def __init__(self, name, mode):
super(myfile, self).__init__(name, mode)
self.write('file header...\n')
The problem that I'm facing now is that the 2to3 script does not find
anything to convert. (I'm also surprised, that running the original
code with "python2.6 -3" does not result in a warning.)
What is the best way to alter my original script to keep it compatible
with python 2.x and get an equivalent python3 script after running
2to3?
thanks a lot,
bernhard
--
Bernhard Leiner http://bernh.net
More information about the Python-porting
mailing list