[issue5513] "What's New" should say VERY CLEARLY that the type file is gone
"Martin v. Löwis" <report@bugs.python.org> at psf.upfronthosting.co.za
"Martin v. Löwis" <report@bugs.python.org> at psf.upfronthosting.co.za
Thu Mar 19 23:51:10 CET 2009
Martin v. Löwis <martin at v.loewis.de> added the comment:
> class file(io.TextIOWrapper):
>
> '''condensing code for this list without test is a no no!'''
>
> def __init__(self,name):
> self.stream = open(name) # SAVE THE STREAM!
> super().__init__(self.stream.buffer)
I don't know what this is supposed to achieve, but it looks incorrect.
I would write it as
py> class file(io.TextIOWrapper):
... def __init__(self, name):
... super().__init__(io.BufferedReader(io.FileIO(name, "r")))
...
Your version creates a separate TextIOWrapper for no apparent reason.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5513>
_______________________________________
More information about the Python-bugs-list
mailing list