9
In python 2, file was a proper class, so I wrote
class MyFile(file):
def floats_from_csv(self):
strs = self.read(1000000).split(',')
for i in strs:
yield float(i)
with MyFile("x.csv", "rt") as x:
for i in x.floats_from_csv():
...
In python3 the numerous file replacements have no public constructors, so I can't subclass and get a __init__ function. I have a hack using delegation, but it's ugly. What is the approved way to create subclasses of the builtin IO classes?